#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
endpoint: Option<String>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD;
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> Self {
Self {
credential,
endpoint: None,
scopes: None,
options: azure_core::ClientOptions::default(),
}
}
#[doc = "Set the endpoint."]
#[must_use]
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
#[doc = "Set the scopes."]
#[must_use]
pub fn scopes(mut self, scopes: &[&str]) -> Self {
self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
self
}
#[doc = "Set the retry options."]
#[must_use]
pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
self.options = self.options.retry(retry);
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
self.options = self.options.transport(transport);
self
}
#[doc = "Convert the builder into a `Client` instance."]
#[must_use]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &str {
self.endpoint.as_str()
}
pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
self.credential.as_ref()
}
pub(crate) fn scopes(&self) -> Vec<&str> {
self.scopes.iter().map(String::as_str).collect()
}
pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
let mut context = azure_core::Context::default();
self.pipeline.send(&mut context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<String>,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
options: azure_core::ClientOptions,
) -> Self {
let endpoint = endpoint.into();
let pipeline = azure_core::Pipeline::new(
option_env!("CARGO_PKG_NAME"),
option_env!("CARGO_PKG_VERSION"),
options,
Vec::new(),
Vec::new(),
);
Self {
endpoint,
credential,
scopes,
pipeline,
}
}
pub fn backup_short_term_retention_policies_client(&self) -> backup_short_term_retention_policies::Client {
backup_short_term_retention_policies::Client(self.clone())
}
pub fn capabilities_client(&self) -> capabilities::Client {
capabilities::Client(self.clone())
}
pub fn data_warehouse_user_activities_client(&self) -> data_warehouse_user_activities::Client {
data_warehouse_user_activities::Client(self.clone())
}
pub fn database_advanced_threat_protection_settings_client(&self) -> database_advanced_threat_protection_settings::Client {
database_advanced_threat_protection_settings::Client(self.clone())
}
pub fn database_advisors_client(&self) -> database_advisors::Client {
database_advisors::Client(self.clone())
}
pub fn database_automatic_tuning_client(&self) -> database_automatic_tuning::Client {
database_automatic_tuning::Client(self.clone())
}
pub fn database_blob_auditing_policies_client(&self) -> database_blob_auditing_policies::Client {
database_blob_auditing_policies::Client(self.clone())
}
pub fn database_columns_client(&self) -> database_columns::Client {
database_columns::Client(self.clone())
}
pub fn database_extensions_client(&self) -> database_extensions::Client {
database_extensions::Client(self.clone())
}
pub fn database_operations_client(&self) -> database_operations::Client {
database_operations::Client(self.clone())
}
pub fn database_recommended_actions_client(&self) -> database_recommended_actions::Client {
database_recommended_actions::Client(self.clone())
}
pub fn database_schemas_client(&self) -> database_schemas::Client {
database_schemas::Client(self.clone())
}
pub fn database_security_alert_policies_client(&self) -> database_security_alert_policies::Client {
database_security_alert_policies::Client(self.clone())
}
pub fn database_tables_client(&self) -> database_tables::Client {
database_tables::Client(self.clone())
}
pub fn database_usages_client(&self) -> database_usages::Client {
database_usages::Client(self.clone())
}
pub fn database_vulnerability_assessment_rule_baselines_client(&self) -> database_vulnerability_assessment_rule_baselines::Client {
database_vulnerability_assessment_rule_baselines::Client(self.clone())
}
pub fn database_vulnerability_assessment_scans_client(&self) -> database_vulnerability_assessment_scans::Client {
database_vulnerability_assessment_scans::Client(self.clone())
}
pub fn database_vulnerability_assessments_client(&self) -> database_vulnerability_assessments::Client {
database_vulnerability_assessments::Client(self.clone())
}
pub fn databases_client(&self) -> databases::Client {
databases::Client(self.clone())
}
pub fn deleted_servers_client(&self) -> deleted_servers::Client {
deleted_servers::Client(self.clone())
}
pub fn distributed_availability_groups_client(&self) -> distributed_availability_groups::Client {
distributed_availability_groups::Client(self.clone())
}
pub fn elastic_pool_operations_client(&self) -> elastic_pool_operations::Client {
elastic_pool_operations::Client(self.clone())
}
pub fn elastic_pools_client(&self) -> elastic_pools::Client {
elastic_pools::Client(self.clone())
}
pub fn encryption_protectors_client(&self) -> encryption_protectors::Client {
encryption_protectors::Client(self.clone())
}
pub fn endpoint_certificates_client(&self) -> endpoint_certificates::Client {
endpoint_certificates::Client(self.clone())
}
pub fn extended_database_blob_auditing_policies_client(&self) -> extended_database_blob_auditing_policies::Client {
extended_database_blob_auditing_policies::Client(self.clone())
}
pub fn extended_server_blob_auditing_policies_client(&self) -> extended_server_blob_auditing_policies::Client {
extended_server_blob_auditing_policies::Client(self.clone())
}
pub fn failover_groups_client(&self) -> failover_groups::Client {
failover_groups::Client(self.clone())
}
pub fn firewall_rules_client(&self) -> firewall_rules::Client {
firewall_rules::Client(self.clone())
}
pub fn i_pv6_firewall_rules_client(&self) -> i_pv6_firewall_rules::Client {
i_pv6_firewall_rules::Client(self.clone())
}
pub fn instance_failover_groups_client(&self) -> instance_failover_groups::Client {
instance_failover_groups::Client(self.clone())
}
pub fn instance_pools_client(&self) -> instance_pools::Client {
instance_pools::Client(self.clone())
}
pub fn job_agents_client(&self) -> job_agents::Client {
job_agents::Client(self.clone())
}
pub fn job_credentials_client(&self) -> job_credentials::Client {
job_credentials::Client(self.clone())
}
pub fn job_executions_client(&self) -> job_executions::Client {
job_executions::Client(self.clone())
}
pub fn job_step_executions_client(&self) -> job_step_executions::Client {
job_step_executions::Client(self.clone())
}
pub fn job_steps_client(&self) -> job_steps::Client {
job_steps::Client(self.clone())
}
pub fn job_target_executions_client(&self) -> job_target_executions::Client {
job_target_executions::Client(self.clone())
}
pub fn job_target_groups_client(&self) -> job_target_groups::Client {
job_target_groups::Client(self.clone())
}
pub fn job_versions_client(&self) -> job_versions::Client {
job_versions::Client(self.clone())
}
pub fn jobs_client(&self) -> jobs::Client {
jobs::Client(self.clone())
}
pub fn ledger_digest_uploads_client(&self) -> ledger_digest_uploads::Client {
ledger_digest_uploads::Client(self.clone())
}
pub fn long_term_retention_backups_client(&self) -> long_term_retention_backups::Client {
long_term_retention_backups::Client(self.clone())
}
pub fn long_term_retention_managed_instance_backups_client(&self) -> long_term_retention_managed_instance_backups::Client {
long_term_retention_managed_instance_backups::Client(self.clone())
}
pub fn long_term_retention_policies_client(&self) -> long_term_retention_policies::Client {
long_term_retention_policies::Client(self.clone())
}
pub fn maintenance_window_options_client(&self) -> maintenance_window_options::Client {
maintenance_window_options::Client(self.clone())
}
pub fn maintenance_windows_client(&self) -> maintenance_windows::Client {
maintenance_windows::Client(self.clone())
}
pub fn managed_backup_short_term_retention_policies_client(&self) -> managed_backup_short_term_retention_policies::Client {
managed_backup_short_term_retention_policies::Client(self.clone())
}
pub fn managed_database_columns_client(&self) -> managed_database_columns::Client {
managed_database_columns::Client(self.clone())
}
pub fn managed_database_queries_client(&self) -> managed_database_queries::Client {
managed_database_queries::Client(self.clone())
}
pub fn managed_database_recommended_sensitivity_labels_client(&self) -> managed_database_recommended_sensitivity_labels::Client {
managed_database_recommended_sensitivity_labels::Client(self.clone())
}
pub fn managed_database_restore_details_client(&self) -> managed_database_restore_details::Client {
managed_database_restore_details::Client(self.clone())
}
pub fn managed_database_schemas_client(&self) -> managed_database_schemas::Client {
managed_database_schemas::Client(self.clone())
}
pub fn managed_database_security_alert_policies_client(&self) -> managed_database_security_alert_policies::Client {
managed_database_security_alert_policies::Client(self.clone())
}
pub fn managed_database_security_events_client(&self) -> managed_database_security_events::Client {
managed_database_security_events::Client(self.clone())
}
pub fn managed_database_sensitivity_labels_client(&self) -> managed_database_sensitivity_labels::Client {
managed_database_sensitivity_labels::Client(self.clone())
}
pub fn managed_database_tables_client(&self) -> managed_database_tables::Client {
managed_database_tables::Client(self.clone())
}
pub fn managed_database_transparent_data_encryption_client(&self) -> managed_database_transparent_data_encryption::Client {
managed_database_transparent_data_encryption::Client(self.clone())
}
pub fn managed_database_vulnerability_assessment_rule_baselines_client(
&self,
) -> managed_database_vulnerability_assessment_rule_baselines::Client {
managed_database_vulnerability_assessment_rule_baselines::Client(self.clone())
}
pub fn managed_database_vulnerability_assessment_scans_client(&self) -> managed_database_vulnerability_assessment_scans::Client {
managed_database_vulnerability_assessment_scans::Client(self.clone())
}
pub fn managed_database_vulnerability_assessments_client(&self) -> managed_database_vulnerability_assessments::Client {
managed_database_vulnerability_assessments::Client(self.clone())
}
pub fn managed_databases_client(&self) -> managed_databases::Client {
managed_databases::Client(self.clone())
}
pub fn managed_instance_administrators_client(&self) -> managed_instance_administrators::Client {
managed_instance_administrators::Client(self.clone())
}
pub fn managed_instance_azure_ad_only_authentications_client(&self) -> managed_instance_azure_ad_only_authentications::Client {
managed_instance_azure_ad_only_authentications::Client(self.clone())
}
pub fn managed_instance_encryption_protectors_client(&self) -> managed_instance_encryption_protectors::Client {
managed_instance_encryption_protectors::Client(self.clone())
}
pub fn managed_instance_keys_client(&self) -> managed_instance_keys::Client {
managed_instance_keys::Client(self.clone())
}
pub fn managed_instance_long_term_retention_policies_client(&self) -> managed_instance_long_term_retention_policies::Client {
managed_instance_long_term_retention_policies::Client(self.clone())
}
pub fn managed_instance_operations_client(&self) -> managed_instance_operations::Client {
managed_instance_operations::Client(self.clone())
}
pub fn managed_instance_private_endpoint_connections_client(&self) -> managed_instance_private_endpoint_connections::Client {
managed_instance_private_endpoint_connections::Client(self.clone())
}
pub fn managed_instance_private_link_resources_client(&self) -> managed_instance_private_link_resources::Client {
managed_instance_private_link_resources::Client(self.clone())
}
pub fn managed_instance_tde_certificates_client(&self) -> managed_instance_tde_certificates::Client {
managed_instance_tde_certificates::Client(self.clone())
}
pub fn managed_instance_vulnerability_assessments_client(&self) -> managed_instance_vulnerability_assessments::Client {
managed_instance_vulnerability_assessments::Client(self.clone())
}
pub fn managed_instances_client(&self) -> managed_instances::Client {
managed_instances::Client(self.clone())
}
pub fn managed_restorable_dropped_database_backup_short_term_retention_policies_client(
&self,
) -> managed_restorable_dropped_database_backup_short_term_retention_policies::Client {
managed_restorable_dropped_database_backup_short_term_retention_policies::Client(self.clone())
}
pub fn managed_server_dns_aliases_client(&self) -> managed_server_dns_aliases::Client {
managed_server_dns_aliases::Client(self.clone())
}
pub fn managed_server_security_alert_policies_client(&self) -> managed_server_security_alert_policies::Client {
managed_server_security_alert_policies::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn outbound_firewall_rules_client(&self) -> outbound_firewall_rules::Client {
outbound_firewall_rules::Client(self.clone())
}
pub fn private_endpoint_connections_client(&self) -> private_endpoint_connections::Client {
private_endpoint_connections::Client(self.clone())
}
pub fn private_link_resources_client(&self) -> private_link_resources::Client {
private_link_resources::Client(self.clone())
}
pub fn recommended_sensitivity_labels_client(&self) -> recommended_sensitivity_labels::Client {
recommended_sensitivity_labels::Client(self.clone())
}
pub fn recoverable_managed_databases_client(&self) -> recoverable_managed_databases::Client {
recoverable_managed_databases::Client(self.clone())
}
pub fn replication_links_client(&self) -> replication_links::Client {
replication_links::Client(self.clone())
}
pub fn restorable_dropped_databases_client(&self) -> restorable_dropped_databases::Client {
restorable_dropped_databases::Client(self.clone())
}
pub fn restorable_dropped_managed_databases_client(&self) -> restorable_dropped_managed_databases::Client {
restorable_dropped_managed_databases::Client(self.clone())
}
pub fn restore_points_client(&self) -> restore_points::Client {
restore_points::Client(self.clone())
}
pub fn sensitivity_labels_client(&self) -> sensitivity_labels::Client {
sensitivity_labels::Client(self.clone())
}
pub fn server_advanced_threat_protection_settings_client(&self) -> server_advanced_threat_protection_settings::Client {
server_advanced_threat_protection_settings::Client(self.clone())
}
pub fn server_advisors_client(&self) -> server_advisors::Client {
server_advisors::Client(self.clone())
}
pub fn server_automatic_tuning_client(&self) -> server_automatic_tuning::Client {
server_automatic_tuning::Client(self.clone())
}
pub fn server_azure_ad_administrators_client(&self) -> server_azure_ad_administrators::Client {
server_azure_ad_administrators::Client(self.clone())
}
pub fn server_azure_ad_only_authentications_client(&self) -> server_azure_ad_only_authentications::Client {
server_azure_ad_only_authentications::Client(self.clone())
}
pub fn server_blob_auditing_policies_client(&self) -> server_blob_auditing_policies::Client {
server_blob_auditing_policies::Client(self.clone())
}
pub fn server_connection_policies_client(&self) -> server_connection_policies::Client {
server_connection_policies::Client(self.clone())
}
pub fn server_dev_ops_audit_settings_client(&self) -> server_dev_ops_audit_settings::Client {
server_dev_ops_audit_settings::Client(self.clone())
}
pub fn server_dns_aliases_client(&self) -> server_dns_aliases::Client {
server_dns_aliases::Client(self.clone())
}
pub fn server_keys_client(&self) -> server_keys::Client {
server_keys::Client(self.clone())
}
pub fn server_operations_client(&self) -> server_operations::Client {
server_operations::Client(self.clone())
}
pub fn server_security_alert_policies_client(&self) -> server_security_alert_policies::Client {
server_security_alert_policies::Client(self.clone())
}
pub fn server_trust_certificates_client(&self) -> server_trust_certificates::Client {
server_trust_certificates::Client(self.clone())
}
pub fn server_trust_groups_client(&self) -> server_trust_groups::Client {
server_trust_groups::Client(self.clone())
}
pub fn server_vulnerability_assessments_client(&self) -> server_vulnerability_assessments::Client {
server_vulnerability_assessments::Client(self.clone())
}
pub fn servers_client(&self) -> servers::Client {
servers::Client(self.clone())
}
pub fn sql_agent_client(&self) -> sql_agent::Client {
sql_agent::Client(self.clone())
}
pub fn subscription_usages_client(&self) -> subscription_usages::Client {
subscription_usages::Client(self.clone())
}
pub fn sync_agents_client(&self) -> sync_agents::Client {
sync_agents::Client(self.clone())
}
pub fn sync_groups_client(&self) -> sync_groups::Client {
sync_groups::Client(self.clone())
}
pub fn sync_members_client(&self) -> sync_members::Client {
sync_members::Client(self.clone())
}
pub fn tde_certificates_client(&self) -> tde_certificates::Client {
tde_certificates::Client(self.clone())
}
pub fn time_zones_client(&self) -> time_zones::Client {
time_zones::Client(self.clone())
}
pub fn transparent_data_encryptions_client(&self) -> transparent_data_encryptions::Client {
transparent_data_encryptions::Client(self.clone())
}
pub fn usages_client(&self) -> usages::Client {
usages::Client(self.clone())
}
pub fn virtual_clusters_client(&self) -> virtual_clusters::Client {
virtual_clusters::Client(self.clone())
}
pub fn virtual_network_rules_client(&self) -> virtual_network_rules::Client {
virtual_network_rules::Client(self.clone())
}
pub fn workload_classifiers_client(&self) -> workload_classifiers::Client {
workload_classifiers::Client(self.clone())
}
pub fn workload_groups_client(&self) -> workload_groups::Client {
workload_groups::Client(self.clone())
}
}
pub mod backup_short_term_retention_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `parameters`: The short term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::BackupShortTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `parameters`: The short term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::BackupShortTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::BackupShortTermRetentionPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::BackupShortTermRetentionPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::BackupShortTermRetentionPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupShortTermRetentionPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::BackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::BackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::BackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::BackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::BackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::BackupShortTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::BackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::BackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::BackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::BackupShortTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::BackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_blob_auditing_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists auditing settings of a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a server's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `parameters`: Properties of blob auditing policy"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
parameters: impl Into<models::ServerBlobAuditingPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerBlobAuditingPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerBlobAuditingPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerBlobAuditingPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/auditingSettings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/auditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.blob_auditing_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) parameters: models::ServerBlobAuditingPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/auditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.blob_auditing_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_blob_auditing_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists auditing settings of a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a database's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `parameters`: The database blob auditing policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
parameters: impl Into<models::DatabaseBlobAuditingPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseBlobAuditingPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseBlobAuditingPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseBlobAuditingPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/auditingSettings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/auditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.blob_auditing_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) parameters: models::DatabaseBlobAuditingPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/auditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.blob_auditing_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod extended_database_blob_auditing_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists extended auditing settings of a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets an extended database's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an extended database's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `parameters`: The extended database blob auditing policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
parameters: impl Into<models::ExtendedDatabaseBlobAuditingPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExtendedDatabaseBlobAuditingPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExtendedDatabaseBlobAuditingPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ExtendedDatabaseBlobAuditingPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/extendedAuditingSettings" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExtendedDatabaseBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExtendedDatabaseBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/extendedAuditingSettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . blob_auditing_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ExtendedDatabaseBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExtendedDatabaseBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExtendedDatabaseBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) parameters: models::ExtendedDatabaseBlobAuditingPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/extendedAuditingSettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . blob_auditing_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ExtendedDatabaseBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod extended_server_blob_auditing_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists extended auditing settings of a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets an extended server's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an extended server's blob auditing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `blob_auditing_policy_name`: The name of the blob auditing policy."]
#[doc = "* `parameters`: Properties of extended blob auditing policy"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
blob_auditing_policy_name: impl Into<String>,
parameters: impl Into<models::ExtendedServerBlobAuditingPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
blob_auditing_policy_name: blob_auditing_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExtendedServerBlobAuditingPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExtendedServerBlobAuditingPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ExtendedServerBlobAuditingPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/extendedAuditingSettings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExtendedServerBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExtendedServerBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/extendedAuditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.blob_auditing_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ExtendedServerBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExtendedServerBlobAuditingPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExtendedServerBlobAuditingPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) blob_auditing_policy_name: String,
pub(crate) parameters: models::ExtendedServerBlobAuditingPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/extendedAuditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.blob_auditing_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ExtendedServerBlobAuditingPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_advanced_threat_protection_settings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of database's Advanced Threat Protection states."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database's Advanced Threat Protection state."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advanced_threat_protection_name`: The name of the Advanced Threat Protection state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advanced_threat_protection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advanced_threat_protection_name: advanced_threat_protection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a database's Advanced Threat Protection state."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advanced_threat_protection_name`: The name of the Advanced Threat Protection state."]
#[doc = "* `parameters`: The database Advanced Threat Protection state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advanced_threat_protection_name: impl Into<String>,
parameters: impl Into<models::DatabaseAdvancedThreatProtection>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advanced_threat_protection_name: advanced_threat_protection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseAdvancedThreatProtectionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseAdvancedThreatProtectionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseAdvancedThreatProtectionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advancedThreatProtectionSettings" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseAdvancedThreatProtection> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseAdvancedThreatProtection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advanced_threat_protection_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advancedThreatProtectionSettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . advanced_threat_protection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseAdvancedThreatProtection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseAdvancedThreatProtection> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseAdvancedThreatProtection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advanced_threat_protection_name: String,
pub(crate) parameters: models::DatabaseAdvancedThreatProtection,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advancedThreatProtectionSettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . advanced_threat_protection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseAdvancedThreatProtection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_advisors {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of database advisors."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a database advisor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advisor_name`: The name of the Database Advisor."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advisor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advisor_name: advisor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a database advisor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advisor_name`: The name of the Database Advisor."]
#[doc = "* `parameters`: The requested advisor resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advisor_name: impl Into<String>,
parameters: impl Into<models::Advisor>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advisor_name: advisor_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::Advisor>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::Advisor> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advisors",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::Advisor>>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Advisor> {
let bytes = self.0.into_body().collect().await?;
let body: models::Advisor = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advisor_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advisors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.advisor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Advisor>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Advisor> {
let bytes = self.0.into_body().collect().await?;
let body: models::Advisor = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advisor_name: String,
pub(crate) parameters: models::Advisor,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advisors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.advisor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Advisor>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_automatic_tuning {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a database's automatic tuning."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update automatic tuning properties for target database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The requested automatic tuning resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::DatabaseAutomaticTuning>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseAutomaticTuning> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseAutomaticTuning = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/automaticTuning/current",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseAutomaticTuning>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseAutomaticTuning> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseAutomaticTuning = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::DatabaseAutomaticTuning,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/automaticTuning/current",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseAutomaticTuning>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_columns {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List database columns"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
schema: Vec::new(),
table: Vec::new(),
column: Vec::new(),
order_by: Vec::new(),
skiptoken: None,
}
}
#[doc = "List database columns"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_table(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_table::RequestBuilder {
list_by_table::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Get database column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseColumnListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseColumnListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) schema: Vec<String>,
pub(crate) table: Vec<String>,
pub(crate) column: Vec<String>,
pub(crate) order_by: Vec<String>,
pub(crate) skiptoken: Option<String>,
}
impl RequestBuilder {
pub fn schema(mut self, schema: Vec<String>) -> Self {
self.schema = schema;
self
}
pub fn table(mut self, table: Vec<String>) -> Self {
self.table = table;
self
}
pub fn column(mut self, column: Vec<String>) -> Self {
self.column = column;
self
}
pub fn order_by(mut self, order_by: Vec<String>) -> Self {
self.order_by = order_by;
self
}
#[doc = "An opaque token that identifies a starting point in the collection."]
pub fn skiptoken(mut self, skiptoken: impl Into<String>) -> Self {
self.skiptoken = Some(skiptoken.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseColumnListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/columns",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let schema = &this.schema;
for value in &this.schema {
req.url_mut().query_pairs_mut().append_pair("schema", &value.to_string());
}
let table = &this.table;
for value in &this.table {
req.url_mut().query_pairs_mut().append_pair("table", &value.to_string());
}
let column = &this.column;
for value in &this.column {
req.url_mut().query_pairs_mut().append_pair("column", &value.to_string());
}
let order_by = &this.order_by;
for value in &this.order_by {
req.url_mut().query_pairs_mut().append_pair("orderBy", &value.to_string());
}
if let Some(skiptoken) = &this.skiptoken {
req.url_mut().query_pairs_mut().append_pair("$skiptoken", skiptoken);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_table {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseColumnListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseColumnListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseColumnListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseColumn> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseColumn = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseColumn>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_extensions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List database extension. This will return an empty list as it is not supported."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database extension. This will return resource not found as it is not supported."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
extension_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
extension_name: extension_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Perform a database extension operation, like database import, database export, or polybase import"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The database import request parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
extension_name: impl Into<String>,
parameters: impl Into<models::DatabaseExtensions>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
extension_name: extension_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ImportExportExtensionsOperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ImportExportExtensionsOperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ImportExportExtensionsOperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/extensions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) extension_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/extensions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.extension_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ImportExportExtensionsOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ImportExportExtensionsOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) extension_name: String,
pub(crate) parameters: models::DatabaseExtensions,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/extensions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.extension_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ImportExportExtensionsOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of operations performed on the database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Cancels the asynchronous operation on the database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `operation_id`: The operation identifier."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn cancel(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
operation_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel::RequestBuilder {
cancel::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
operation_id: operation_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseOperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseOperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseOperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/operations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod cancel {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) operation_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/operations/{}/cancel",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.operation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod database_recommended_actions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets list of Database Recommended Actions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advisor_name`: The name of the Database Advisor."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database_advisor(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advisor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database_advisor::RequestBuilder {
list_by_database_advisor::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advisor_name: advisor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database recommended action."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advisor_name`: The name of the Database Advisor."]
#[doc = "* `recommended_action_name`: The name of Database Recommended Action."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advisor_name: impl Into<String>,
recommended_action_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advisor_name: advisor_name.into(),
recommended_action_name: recommended_action_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a database recommended action."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `advisor_name`: The name of the Database Advisor."]
#[doc = "* `recommended_action_name`: The name of Database Recommended Action."]
#[doc = "* `parameters`: The requested recommended action resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
advisor_name: impl Into<String>,
recommended_action_name: impl Into<String>,
parameters: impl Into<models::RecommendedAction>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
advisor_name: advisor_name.into(),
recommended_action_name: recommended_action_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database_advisor {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::RecommendedAction>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::RecommendedAction> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advisor_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advisors/{}/recommendedActions" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . advisor_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::RecommendedAction>>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RecommendedAction> {
let bytes = self.0.into_body().collect().await?;
let body: models::RecommendedAction = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advisor_name: String,
pub(crate) recommended_action_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advisors/{}/recommendedActions/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . advisor_name , & this . recommended_action_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RecommendedAction>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RecommendedAction> {
let bytes = self.0.into_body().collect().await?;
let body: models::RecommendedAction = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) advisor_name: String,
pub(crate) recommended_action_name: String,
pub(crate) parameters: models::RecommendedAction,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/advisors/{}/recommendedActions/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . advisor_name , & this . recommended_action_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RecommendedAction>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod databases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of databases."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
skip_token: None,
}
}
#[doc = "Gets a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new database or updates an existing database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The requested database resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::Database>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The requested database resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::DatabaseUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Exports a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The database export request parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn export(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::ExportDatabaseDefinition>,
subscription_id: impl Into<String>,
) -> export::RequestBuilder {
export::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Failovers a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to failover."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover::RequestBuilder {
failover::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
replica_type: None,
}
}
#[doc = "Imports a bacpac into a new database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The database import request parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn import(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::ImportExistingDatabaseDefinition>,
subscription_id: impl Into<String>,
) -> import::RequestBuilder {
import::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Renames a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to rename."]
#[doc = "* `parameters`: The resource move definition for renaming this database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn rename(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::ResourceMoveDefinition>,
subscription_id: impl Into<String>,
) -> rename::RequestBuilder {
rename::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Pauses a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to be paused."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn pause(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> pause::RequestBuilder {
pause::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Resumes a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to be resumed."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn resume(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> resume::RequestBuilder {
resume::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Upgrades a data warehouse."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to be upgraded."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn upgrade_data_warehouse(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> upgrade_data_warehouse::RequestBuilder {
upgrade_data_warehouse::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of databases in an elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `elastic_pool_name`: The name of the elastic pool."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_elastic_pool(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_elastic_pool::RequestBuilder {
list_by_elastic_pool::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of inaccessible databases in a logical server"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_inaccessible_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_inaccessible_by_server::RequestBuilder {
list_inaccessible_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
pub(crate) skip_token: Option<String>,
}
impl RequestBuilder {
pub fn skip_token(mut self, skip_token: impl Into<String>) -> Self {
self.skip_token = Some(skip_token.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(skip_token) = &this.skip_token {
req.url_mut().query_pairs_mut().append_pair("$skipToken", skip_token);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Database> {
let bytes = self.0.into_body().collect().await?;
let body: models::Database = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Database>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Database> {
let bytes = self.0.into_body().collect().await?;
let body: models::Database = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::Database,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Database>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Database> {
let bytes = self.0.into_body().collect().await?;
let body: models::Database = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::DatabaseUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Database>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod export {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ImportExportOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ImportExportOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::ExportDatabaseDefinition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/export",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ImportExportOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod failover {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) replica_type: Option<String>,
}
impl RequestBuilder {
#[doc = "The type of replica to be failed over."]
pub fn replica_type(mut self, replica_type: impl Into<String>) -> Self {
self.replica_type = Some(replica_type.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/failover",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(replica_type) = &this.replica_type {
req.url_mut().query_pairs_mut().append_pair("replicaType", replica_type);
}
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod import {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ImportExportOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ImportExportOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::ImportExistingDatabaseDefinition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/import",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ImportExportOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod rename {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::ResourceMoveDefinition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/move",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod pause {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Database> {
let bytes = self.0.into_body().collect().await?;
let body: models::Database = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/pause",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Database>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod resume {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Database> {
let bytes = self.0.into_body().collect().await?;
let body: models::Database = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/resume",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Database>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod upgrade_data_warehouse {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/upgradeDataWarehouse",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_elastic_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}/databases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_inaccessible_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/inaccessibleDatabases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod database_schemas {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List database schemas"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Get database schema"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSchemaListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSchemaListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseSchemaListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSchema> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSchema = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.schema_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseSchema>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_security_alert_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of database's security alert policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the security alert policy is defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database's security alert policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the security alert policy is defined."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a database's security alert policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the security alert policy is defined."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `parameters`: The database security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
parameters: impl Into<models::DatabaseSecurityAlertPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSecurityAlertListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSecurityAlertListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseSecurityAlertListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/securityAlertPolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/securityAlertPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . security_alert_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) parameters: models::DatabaseSecurityAlertPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/securityAlertPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . security_alert_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_tables {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List database tables"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_schema(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_schema::RequestBuilder {
list_by_schema::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Get database table"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_schema {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseTableListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseTableListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseTableListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.schema_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseTable> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseTable = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.schema_name,
&this.table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseTable>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod database_usages {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets database usages."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseUsageListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseUsageListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseUsageListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/usages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod database_vulnerability_assessment_rule_baselines {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a database's vulnerability assessment rule baseline."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment rule baseline is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `rule_id`: The vulnerability assessment rule ID."]
#[doc = "* `baseline_name`: The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule)."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
rule_id: impl Into<String>,
baseline_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
rule_id: rule_id.into(),
baseline_name: baseline_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a database's vulnerability assessment rule baseline."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment rule baseline is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `rule_id`: The vulnerability assessment rule ID."]
#[doc = "* `baseline_name`: The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule)."]
#[doc = "* `parameters`: The requested rule baseline resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
rule_id: impl Into<String>,
baseline_name: impl Into<String>,
parameters: impl Into<models::DatabaseVulnerabilityAssessmentRuleBaseline>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
rule_id: rule_id.into(),
baseline_name: baseline_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Removes the database's vulnerability assessment rule baseline."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment rule baseline is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `rule_id`: The vulnerability assessment rule ID."]
#[doc = "* `baseline_name`: The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule)."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
rule_id: impl Into<String>,
baseline_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
rule_id: rule_id.into(),
baseline_name: baseline_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentRuleBaseline = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) rule_id: String,
pub(crate) baseline_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/rules/{}/baselines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name , & this . rule_id , & this . baseline_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentRuleBaseline = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) rule_id: String,
pub(crate) baseline_name: String,
pub(crate) parameters: models::DatabaseVulnerabilityAssessmentRuleBaseline,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/rules/{}/baselines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name , & this . rule_id , & this . baseline_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) rule_id: String,
pub(crate) baseline_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/rules/{}/baselines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name , & this . rule_id , & this . baseline_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod database_vulnerability_assessments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the vulnerability assessment policies associated with a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment policies are defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the database's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the database's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `parameters`: The requested resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
parameters: impl Into<models::DatabaseVulnerabilityAssessment>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Removes the database's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseVulnerabilityAssessmentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) parameters: models::DatabaseVulnerabilityAssessment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod database_vulnerability_assessment_scans {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the vulnerability assessment scans of a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a vulnerability assessment scan record of a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `scan_id`: The vulnerability assessment scan Id of the scan to retrieve."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
scan_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
scan_id: scan_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Convert an existing scan result to a human readable format. If already exists nothing happens"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the scanned database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `scan_id`: The vulnerability assessment scan Id."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn export(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
scan_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> export::RequestBuilder {
export::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
scan_id: scan_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Executes a Vulnerability Assessment database scan."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `scan_id`: The vulnerability assessment scan Id of the scan to retrieve."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn initiate_scan(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
scan_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> initiate_scan::RequestBuilder {
initiate_scan::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
scan_id: scan_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VulnerabilityAssessmentScanRecordListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::VulnerabilityAssessmentScanRecordListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::VulnerabilityAssessmentScanRecordListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/scans" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VulnerabilityAssessmentScanRecord> {
let bytes = self.0.into_body().collect().await?;
let body: models::VulnerabilityAssessmentScanRecord = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) scan_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/scans/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name , & this . scan_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VulnerabilityAssessmentScanRecord>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod export {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentScansExport> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentScansExport = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) scan_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/scans/{}/export" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name , & this . scan_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessmentScansExport>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod initiate_scan {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) scan_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/vulnerabilityAssessments/{}/scans/{}/initiateScan" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . vulnerability_assessment_name , & this . scan_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod data_warehouse_user_activities {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List the user activities of a data warehouse which includes running and suspended queries"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the user activities of a data warehouse which includes running and suspended queries"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `data_warehouse_user_activity_name`: The activity name of the data warehouse. "]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
data_warehouse_user_activity_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
data_warehouse_user_activity_name: data_warehouse_user_activity_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DataWarehouseUserActivitiesListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DataWarehouseUserActivitiesListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DataWarehouseUserActivitiesListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/dataWarehouseUserActivities" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DataWarehouseUserActivities> {
let bytes = self.0.into_body().collect().await?;
let body: models::DataWarehouseUserActivities = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) data_warehouse_user_activity_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/dataWarehouseUserActivities/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . data_warehouse_user_activity_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DataWarehouseUserActivities>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod deleted_servers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of all deleted servers in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of deleted servers for a location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a deleted server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `deleted_server_name`: The name of the deleted server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
location_name: impl Into<String>,
deleted_server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
deleted_server_name: deleted_server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Recovers a deleted server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `deleted_server_name`: The name of the deleted server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn recover(
&self,
location_name: impl Into<String>,
deleted_server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> recover::RequestBuilder {
recover::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
deleted_server_name: deleted_server_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeletedServerListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeletedServerListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DeletedServerListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/deletedServers",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeletedServerListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeletedServerListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DeletedServerListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/deletedServers",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeletedServer> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeletedServer = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) deleted_server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/deletedServers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.location_name,
&this.deleted_server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DeletedServer>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod recover {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeletedServer> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeletedServer = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) deleted_server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/deletedServers/{}/recover",
this.client.endpoint(),
&this.subscription_id,
&this.location_name,
&this.deleted_server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DeletedServer>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod distributed_availability_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of a distributed availability groups in instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a distributed availability group info."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `distributed_availability_group_name`: The distributed availability group name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
distributed_availability_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
distributed_availability_group_name: distributed_availability_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a distributed availability group between Sql On-Prem and Sql Managed Instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `distributed_availability_group_name`: The distributed availability group name."]
#[doc = "* `parameters`: The distributed availability group info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
distributed_availability_group_name: impl Into<String>,
parameters: impl Into<models::DistributedAvailabilityGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
distributed_availability_group_name: distributed_availability_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a distributed availability group replication mode."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `distributed_availability_group_name`: The distributed availability group name."]
#[doc = "* `parameters`: The distributed availability group info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
distributed_availability_group_name: impl Into<String>,
parameters: impl Into<models::DistributedAvailabilityGroup>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
distributed_availability_group_name: distributed_availability_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Drops a distributed availability group between Sql On-Prem and Sql Managed Instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `distributed_availability_group_name`: The distributed availability group name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
distributed_availability_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
distributed_availability_group_name: distributed_availability_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DistributedAvailabilityGroupsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DistributedAvailabilityGroupsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DistributedAvailabilityGroupsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/distributedAvailabilityGroups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DistributedAvailabilityGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::DistributedAvailabilityGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) distributed_availability_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/distributedAvailabilityGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . distributed_availability_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DistributedAvailabilityGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DistributedAvailabilityGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::DistributedAvailabilityGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) distributed_availability_group_name: String,
pub(crate) parameters: models::DistributedAvailabilityGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/distributedAvailabilityGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . distributed_availability_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DistributedAvailabilityGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DistributedAvailabilityGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::DistributedAvailabilityGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) distributed_availability_group_name: String,
pub(crate) parameters: models::DistributedAvailabilityGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/distributedAvailabilityGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . distributed_availability_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DistributedAvailabilityGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) distributed_availability_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/distributedAvailabilityGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . distributed_availability_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod elastic_pool_operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of operations performed on the elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_elastic_pool(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_elastic_pool::RequestBuilder {
list_by_elastic_pool::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Cancels the asynchronous operation on the elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `operation_id`: The operation identifier."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn cancel(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
operation_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel::RequestBuilder {
cancel::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
operation_id: operation_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_elastic_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ElasticPoolOperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ElasticPoolOperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ElasticPoolOperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}/operations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod cancel {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) operation_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}/operations/{}/cancel",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name,
&this.operation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod elastic_pools {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all elastic pools in a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
skip: None,
}
}
#[doc = "Gets an elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `elastic_pool_name`: The name of the elastic pool."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `elastic_pool_name`: The name of the elastic pool."]
#[doc = "* `parameters`: The elastic pool parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
parameters: impl Into<models::ElasticPool>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `elastic_pool_name`: The name of the elastic pool."]
#[doc = "* `parameters`: The elastic pool update parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
parameters: impl Into<models::ElasticPoolUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `elastic_pool_name`: The name of the elastic pool."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Failovers an elastic pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `elastic_pool_name`: The name of the elastic pool to failover."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
elastic_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover::RequestBuilder {
failover::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
elastic_pool_name: elastic_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ElasticPoolListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ElasticPoolListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
pub(crate) skip: Option<i64>,
}
impl RequestBuilder {
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ElasticPoolListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ElasticPool> {
let bytes = self.0.into_body().collect().await?;
let body: models::ElasticPool = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ElasticPool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ElasticPool> {
let bytes = self.0.into_body().collect().await?;
let body: models::ElasticPool = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) parameters: models::ElasticPool,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ElasticPool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ElasticPool> {
let bytes = self.0.into_body().collect().await?;
let body: models::ElasticPool = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) parameters: models::ElasticPoolUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ElasticPool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod failover {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) elastic_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/elasticPools/{}/failover",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.elastic_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod encryption_protectors {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server encryption protectors"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server encryption protector."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `encryption_protector_name`: The name of the encryption protector to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
encryption_protector_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
encryption_protector_name: encryption_protector_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing encryption protector."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `encryption_protector_name`: The name of the encryption protector to be updated."]
#[doc = "* `parameters`: The requested encryption protector resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
encryption_protector_name: impl Into<String>,
parameters: impl Into<models::EncryptionProtector>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
encryption_protector_name: encryption_protector_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Revalidates an existing encryption protector."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `encryption_protector_name`: The name of the encryption protector to be updated."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn revalidate(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
encryption_protector_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> revalidate::RequestBuilder {
revalidate::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
encryption_protector_name: encryption_protector_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EncryptionProtectorListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EncryptionProtectorListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::EncryptionProtectorListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/encryptionProtector",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EncryptionProtector> {
let bytes = self.0.into_body().collect().await?;
let body: models::EncryptionProtector = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) encryption_protector_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/encryptionProtector/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.encryption_protector_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::EncryptionProtector>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EncryptionProtector> {
let bytes = self.0.into_body().collect().await?;
let body: models::EncryptionProtector = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) encryption_protector_name: String,
pub(crate) parameters: models::EncryptionProtector,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/encryptionProtector/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.encryption_protector_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::EncryptionProtector>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod revalidate {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) encryption_protector_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/encryptionProtector/{}/revalidate",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.encryption_protector_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod endpoint_certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List certificates used on endpoints on the target instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a certificate used on the endpoint with the given id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `endpoint_type`: Type of the endpoint whose certificate the customer is looking for."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
endpoint_type: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
endpoint_type: endpoint_type.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EndpointCertificateListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EndpointCertificateListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::EndpointCertificateListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/endpointCertificates",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EndpointCertificate> {
let bytes = self.0.into_body().collect().await?;
let body: models::EndpointCertificate = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) endpoint_type: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/endpointCertificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.endpoint_type
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::EndpointCertificate>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod failover_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the failover groups in a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `parameters`: The failover group parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
failover_group_name: impl Into<String>,
parameters: impl Into<models::FailoverGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
failover_group_name: failover_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `parameters`: The failover group parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
failover_group_name: impl Into<String>,
parameters: impl Into<models::FailoverGroupUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
failover_group_name: failover_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fails over from the current primary server to this server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover::RequestBuilder {
failover::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fails over from the current primary server to this server. This operation might result in data loss."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server containing the failover group."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn force_failover_allow_data_loss(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> force_failover_allow_data_loss::RequestBuilder {
force_failover_allow_data_loss::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FailoverGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::FailoverGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::FailoverGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::FailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::FailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) failover_group_name: String,
pub(crate) parameters: models::FailoverGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::FailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) failover_group_name: String,
pub(crate) parameters: models::FailoverGroupUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod failover {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::FailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups/{}/failover",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod force_failover_allow_data_loss {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::FailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/failoverGroups/{}/forceFailoverAllowDataLoss" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . failover_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod firewall_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of firewall rules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Replaces all firewall rules on the server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn replace(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
parameters: impl Into<models::FirewallRuleList>,
subscription_id: impl Into<String>,
) -> replace::RequestBuilder {
replace::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `firewall_rule_name`: The name of the firewall rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
firewall_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
firewall_rule_name: firewall_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `firewall_rule_name`: The name of the firewall rule."]
#[doc = "* `parameters`: The required parameters for creating or updating a firewall rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
firewall_rule_name: impl Into<String>,
parameters: impl Into<models::FirewallRule>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
firewall_rule_name: firewall_rule_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `firewall_rule_name`: The name of the firewall rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
firewall_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
firewall_rule_name: firewall_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FirewallRuleListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::FirewallRuleListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::FirewallRuleListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/firewallRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod replace {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::FirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) parameters: models::FirewallRuleList,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/firewallRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::FirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) firewall_rule_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/firewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.firewall_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::FirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::FirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) firewall_rule_name: String,
pub(crate) parameters: models::FirewallRule,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/firewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.firewall_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::FirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) firewall_rule_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/firewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.firewall_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod instance_failover_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the failover groups in a location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `parameters`: The failover group parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
failover_group_name: impl Into<String>,
parameters: impl Into<models::InstanceFailoverGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
failover_group_name: failover_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a failover group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fails over from the current primary managed instance to this managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover::RequestBuilder {
failover::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fails over from the current primary managed instance to this managed instance. This operation might result in data loss."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `failover_group_name`: The name of the failover group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn force_failover_allow_data_loss(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
failover_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> force_failover_allow_data_loss::RequestBuilder {
force_failover_allow_data_loss::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
failover_group_name: failover_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstanceFailoverGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstanceFailoverGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::InstanceFailoverGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/instanceFailoverGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstanceFailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstanceFailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/instanceFailoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstanceFailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstanceFailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstanceFailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) failover_group_name: String,
pub(crate) parameters: models::InstanceFailoverGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/instanceFailoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstanceFailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/instanceFailoverGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod failover {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstanceFailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstanceFailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/instanceFailoverGroups/{}/failover",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.failover_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstanceFailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod force_failover_allow_data_loss {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstanceFailoverGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstanceFailoverGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) failover_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/instanceFailoverGroups/{}/forceFailoverAllowDataLoss" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . failover_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstanceFailoverGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod instance_pools {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of all instance pools in the subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of instance pools in the resource group"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets an instance pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `instance_pool_name`: The name of the instance pool to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
instance_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
instance_pool_name: instance_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an instance pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `instance_pool_name`: The name of the instance pool to be created or updated."]
#[doc = "* `parameters`: The requested instance pool resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
instance_pool_name: impl Into<String>,
parameters: impl Into<models::InstancePool>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
instance_pool_name: instance_pool_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an instance pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `instance_pool_name`: The name of the instance pool to be updated."]
#[doc = "* `parameters`: The requested instance pool resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
instance_pool_name: impl Into<String>,
parameters: impl Into<models::InstancePoolUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
instance_pool_name: instance_pool_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an instance pool"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `instance_pool_name`: The name of the instance pool to be deleted"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
instance_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
instance_pool_name: instance_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstancePoolListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstancePoolListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::InstancePoolListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/instancePools",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstancePoolListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstancePoolListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::InstancePoolListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstancePool> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstancePool = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) instance_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.instance_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstancePool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstancePool> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstancePool = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) instance_pool_name: String,
pub(crate) parameters: models::InstancePool,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.instance_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstancePool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::InstancePool> {
let bytes = self.0.into_body().collect().await?;
let body: models::InstancePool = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) instance_pool_name: String,
pub(crate) parameters: models::InstancePoolUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.instance_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::InstancePool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) instance_pool_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.instance_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod i_pv6_firewall_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of IPv6 firewall rules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets an IPv6 firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `firewall_rule_name`: The name of the firewall rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
firewall_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
firewall_rule_name: firewall_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an IPv6 firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `firewall_rule_name`: The name of the firewall rule."]
#[doc = "* `parameters`: The required parameters for creating or updating an IPv6 firewall rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
firewall_rule_name: impl Into<String>,
parameters: impl Into<models::IPv6FirewallRule>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
firewall_rule_name: firewall_rule_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an IPv6 firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `firewall_rule_name`: The name of the firewall rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
firewall_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
firewall_rule_name: firewall_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IPv6FirewallRuleListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::IPv6FirewallRuleListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::IPv6FirewallRuleListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/ipv6FirewallRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IPv6FirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::IPv6FirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) firewall_rule_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/ipv6FirewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.firewall_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IPv6FirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IPv6FirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::IPv6FirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) firewall_rule_name: String,
pub(crate) parameters: models::IPv6FirewallRule,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/ipv6FirewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.firewall_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IPv6FirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) firewall_rule_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/ipv6FirewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.firewall_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod job_agents {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of job agents in a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a job agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a job agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent to be created or updated."]
#[doc = "* `parameters`: The requested job agent resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
parameters: impl Into<models::JobAgent>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a job agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent to be updated."]
#[doc = "* `parameters`: The update to the job agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
parameters: impl Into<models::JobAgentUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a job agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent to be deleted."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobAgentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobAgentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobAgentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobAgent> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobAgent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobAgent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobAgent> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobAgent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) parameters: models::JobAgent,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobAgent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobAgent> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobAgent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) parameters: models::JobAgentUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobAgent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod job_credentials {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of jobs credentials."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_agent(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_agent::RequestBuilder {
list_by_agent::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a jobs credential."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `credential_name`: The name of the credential."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
credential_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
credential_name: credential_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a job credential."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `credential_name`: The name of the credential."]
#[doc = "* `parameters`: The requested job credential state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
credential_name: impl Into<String>,
parameters: impl Into<models::JobCredential>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
credential_name: credential_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a job credential."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `credential_name`: The name of the credential."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
credential_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
credential_name: credential_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_agent {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobCredentialListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobCredentialListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobCredentialListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/credentials",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobCredential> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobCredential = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) credential_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/credentials/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.credential_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobCredential>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobCredential> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobCredential = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) credential_name: String,
pub(crate) parameters: models::JobCredential,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/credentials/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.credential_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobCredential>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) credential_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/credentials/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.credential_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod job_executions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all executions in a job agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_agent(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_agent::RequestBuilder {
list_by_agent::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
subscription_id: subscription_id.into(),
create_time_min: None,
create_time_max: None,
end_time_min: None,
end_time_max: None,
is_active: None,
skip: None,
top: None,
}
}
#[doc = "Lists a job's executions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_job(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_job::RequestBuilder {
list_by_job::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
subscription_id: subscription_id.into(),
create_time_min: None,
create_time_max: None,
end_time_min: None,
end_time_max: None,
is_active: None,
skip: None,
top: None,
}
}
#[doc = "Gets a job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `job_execution_id`: The id of the job execution"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_execution_id`: The job execution id to create the job execution under."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Requests cancellation of a job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `job_execution_id`: The id of the job execution to cancel."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn cancel(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel::RequestBuilder {
cancel::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Starts an elastic job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_agent {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecutionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecutionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) subscription_id: String,
pub(crate) create_time_min: Option<time::OffsetDateTime>,
pub(crate) create_time_max: Option<time::OffsetDateTime>,
pub(crate) end_time_min: Option<time::OffsetDateTime>,
pub(crate) end_time_max: Option<time::OffsetDateTime>,
pub(crate) is_active: Option<bool>,
pub(crate) skip: Option<i64>,
pub(crate) top: Option<i64>,
}
impl RequestBuilder {
#[doc = "If specified, only job executions created at or after the specified time are included."]
pub fn create_time_min(mut self, create_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_min = Some(create_time_min.into());
self
}
#[doc = "If specified, only job executions created before the specified time are included."]
pub fn create_time_max(mut self, create_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_max = Some(create_time_max.into());
self
}
#[doc = "If specified, only job executions completed at or after the specified time are included."]
pub fn end_time_min(mut self, end_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_min = Some(end_time_min.into());
self
}
#[doc = "If specified, only job executions completed before the specified time are included."]
pub fn end_time_max(mut self, end_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_max = Some(end_time_max.into());
self
}
#[doc = "If specified, only active or only completed job executions are included."]
pub fn is_active(mut self, is_active: bool) -> Self {
self.is_active = Some(is_active);
self
}
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of elements to return from the collection."]
pub fn top(mut self, top: i64) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::JobExecutionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/executions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(create_time_min) = &this.create_time_min {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMin", &create_time_min.to_string());
}
if let Some(create_time_max) = &this.create_time_max {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMax", &create_time_max.to_string());
}
if let Some(end_time_min) = &this.end_time_min {
req.url_mut().query_pairs_mut().append_pair("endTimeMin", &end_time_min.to_string());
}
if let Some(end_time_max) = &this.end_time_max {
req.url_mut().query_pairs_mut().append_pair("endTimeMax", &end_time_max.to_string());
}
if let Some(is_active) = &this.is_active {
req.url_mut().query_pairs_mut().append_pair("isActive", &is_active.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_job {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecutionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecutionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) subscription_id: String,
pub(crate) create_time_min: Option<time::OffsetDateTime>,
pub(crate) create_time_max: Option<time::OffsetDateTime>,
pub(crate) end_time_min: Option<time::OffsetDateTime>,
pub(crate) end_time_max: Option<time::OffsetDateTime>,
pub(crate) is_active: Option<bool>,
pub(crate) skip: Option<i64>,
pub(crate) top: Option<i64>,
}
impl RequestBuilder {
#[doc = "If specified, only job executions created at or after the specified time are included."]
pub fn create_time_min(mut self, create_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_min = Some(create_time_min.into());
self
}
#[doc = "If specified, only job executions created before the specified time are included."]
pub fn create_time_max(mut self, create_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_max = Some(create_time_max.into());
self
}
#[doc = "If specified, only job executions completed at or after the specified time are included."]
pub fn end_time_min(mut self, end_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_min = Some(end_time_min.into());
self
}
#[doc = "If specified, only job executions completed before the specified time are included."]
pub fn end_time_max(mut self, end_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_max = Some(end_time_max.into());
self
}
#[doc = "If specified, only active or only completed job executions are included."]
pub fn is_active(mut self, is_active: bool) -> Self {
self.is_active = Some(is_active);
self
}
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of elements to return from the collection."]
pub fn top(mut self, top: i64) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::JobExecutionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(create_time_min) = &this.create_time_min {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMin", &create_time_min.to_string());
}
if let Some(create_time_max) = &this.create_time_max {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMax", &create_time_max.to_string());
}
if let Some(end_time_min) = &this.end_time_min {
req.url_mut().query_pairs_mut().append_pair("endTimeMin", &end_time_min.to_string());
}
if let Some(end_time_max) = &this.end_time_max {
req.url_mut().query_pairs_mut().append_pair("endTimeMax", &end_time_max.to_string());
}
if let Some(is_active) = &this.is_active {
req.url_mut().query_pairs_mut().append_pair("isActive", &is_active.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name,
&this.job_execution_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name,
&this.job_execution_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod cancel {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}/cancel" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_execution_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/start",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod jobs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of jobs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_agent(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_agent::RequestBuilder {
list_by_agent::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a job."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a job."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `parameters`: The requested job state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
parameters: impl Into<models::Job>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a job."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to delete."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_agent {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Job> {
let bytes = self.0.into_body().collect().await?;
let body: models::Job = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Job>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Job> {
let bytes = self.0.into_body().collect().await?;
let body: models::Job = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) parameters: models::Job,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Job>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod job_step_executions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the step executions of a job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_execution_id`: The id of the job execution"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_job_execution(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_job_execution::RequestBuilder {
list_by_job_execution::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
subscription_id: subscription_id.into(),
create_time_min: None,
create_time_max: None,
end_time_min: None,
end_time_max: None,
is_active: None,
skip: None,
top: None,
}
}
#[doc = "Gets a step execution of a job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_execution_id`: The unique id of the job execution"]
#[doc = "* `step_name`: The name of the step."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
step_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
step_name: step_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_job_execution {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecutionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecutionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) subscription_id: String,
pub(crate) create_time_min: Option<time::OffsetDateTime>,
pub(crate) create_time_max: Option<time::OffsetDateTime>,
pub(crate) end_time_min: Option<time::OffsetDateTime>,
pub(crate) end_time_max: Option<time::OffsetDateTime>,
pub(crate) is_active: Option<bool>,
pub(crate) skip: Option<i64>,
pub(crate) top: Option<i64>,
}
impl RequestBuilder {
#[doc = "If specified, only job executions created at or after the specified time are included."]
pub fn create_time_min(mut self, create_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_min = Some(create_time_min.into());
self
}
#[doc = "If specified, only job executions created before the specified time are included."]
pub fn create_time_max(mut self, create_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_max = Some(create_time_max.into());
self
}
#[doc = "If specified, only job executions completed at or after the specified time are included."]
pub fn end_time_min(mut self, end_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_min = Some(end_time_min.into());
self
}
#[doc = "If specified, only job executions completed before the specified time are included."]
pub fn end_time_max(mut self, end_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_max = Some(end_time_max.into());
self
}
#[doc = "If specified, only active or only completed job executions are included."]
pub fn is_active(mut self, is_active: bool) -> Self {
self.is_active = Some(is_active);
self
}
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of elements to return from the collection."]
pub fn top(mut self, top: i64) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::JobExecutionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}/steps" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_execution_id)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(create_time_min) = &this.create_time_min {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMin", &create_time_min.to_string());
}
if let Some(create_time_max) = &this.create_time_max {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMax", &create_time_max.to_string());
}
if let Some(end_time_min) = &this.end_time_min {
req.url_mut().query_pairs_mut().append_pair("endTimeMin", &end_time_min.to_string());
}
if let Some(end_time_max) = &this.end_time_max {
req.url_mut().query_pairs_mut().append_pair("endTimeMax", &end_time_max.to_string());
}
if let Some(is_active) = &this.is_active {
req.url_mut().query_pairs_mut().append_pair("isActive", &is_active.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) step_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}/steps/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_execution_id , & this . step_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod job_steps {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all job steps for a job's current version."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_job(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_job::RequestBuilder {
list_by_job::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a job step in a job's current version."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `step_name`: The name of the job step."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
step_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
step_name: step_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a job step. This will implicitly create a new job version."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `step_name`: The name of the job step."]
#[doc = "* `parameters`: The requested state of the job step."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
step_name: impl Into<String>,
parameters: impl Into<models::JobStep>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
step_name: step_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a job step. This will implicitly create a new job version."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `step_name`: The name of the job step to delete."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
step_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
step_name: step_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all job steps in the specified job version."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_version`: The version of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_version(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_version: i32,
subscription_id: impl Into<String>,
) -> list_by_version::RequestBuilder {
list_by_version::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_version,
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the specified version of a job step."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `job_version`: The version of the job to get."]
#[doc = "* `step_name`: The name of the job step."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get_by_version(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_version: i32,
step_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_by_version::RequestBuilder {
get_by_version::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_version,
step_name: step_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_job {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobStepListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobStepListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobStepListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/steps",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobStep> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobStep = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) step_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/steps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name,
&this.step_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobStep>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobStep> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobStep = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) step_name: String,
pub(crate) parameters: models::JobStep,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/steps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name,
&this.step_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobStep>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) step_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/steps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name,
&this.step_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_version {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobStepListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobStepListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_version: i32,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobStepListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/versions/{}/steps" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_version)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_by_version {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobStep> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobStep = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_version: i32,
pub(crate) step_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/versions/{}/steps/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_version , & this . step_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobStep>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod job_target_executions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the target executions of a job step execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_execution_id`: The id of the job execution"]
#[doc = "* `step_name`: The name of the step."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_step(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
step_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_step::RequestBuilder {
list_by_step::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
step_name: step_name.into(),
subscription_id: subscription_id.into(),
create_time_min: None,
create_time_max: None,
end_time_min: None,
end_time_max: None,
is_active: None,
skip: None,
top: None,
}
}
#[doc = "Gets a target execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_execution_id`: The unique id of the job execution"]
#[doc = "* `step_name`: The name of the step."]
#[doc = "* `target_id`: The target id."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
step_name: impl Into<String>,
target_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
step_name: step_name.into(),
target_id: target_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists target executions for all steps of a job execution."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `job_execution_id`: The id of the job execution"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_job_execution(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_execution_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_job_execution::RequestBuilder {
list_by_job_execution::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_execution_id: job_execution_id.into(),
subscription_id: subscription_id.into(),
create_time_min: None,
create_time_max: None,
end_time_min: None,
end_time_max: None,
is_active: None,
skip: None,
top: None,
}
}
}
pub mod list_by_step {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecutionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecutionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) step_name: String,
pub(crate) subscription_id: String,
pub(crate) create_time_min: Option<time::OffsetDateTime>,
pub(crate) create_time_max: Option<time::OffsetDateTime>,
pub(crate) end_time_min: Option<time::OffsetDateTime>,
pub(crate) end_time_max: Option<time::OffsetDateTime>,
pub(crate) is_active: Option<bool>,
pub(crate) skip: Option<i64>,
pub(crate) top: Option<i64>,
}
impl RequestBuilder {
#[doc = "If specified, only job executions created at or after the specified time are included."]
pub fn create_time_min(mut self, create_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_min = Some(create_time_min.into());
self
}
#[doc = "If specified, only job executions created before the specified time are included."]
pub fn create_time_max(mut self, create_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_max = Some(create_time_max.into());
self
}
#[doc = "If specified, only job executions completed at or after the specified time are included."]
pub fn end_time_min(mut self, end_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_min = Some(end_time_min.into());
self
}
#[doc = "If specified, only job executions completed before the specified time are included."]
pub fn end_time_max(mut self, end_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_max = Some(end_time_max.into());
self
}
#[doc = "If specified, only active or only completed job executions are included."]
pub fn is_active(mut self, is_active: bool) -> Self {
self.is_active = Some(is_active);
self
}
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of elements to return from the collection."]
pub fn top(mut self, top: i64) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::JobExecutionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}/steps/{}/targets" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_execution_id , & this . step_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(create_time_min) = &this.create_time_min {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMin", &create_time_min.to_string());
}
if let Some(create_time_max) = &this.create_time_max {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMax", &create_time_max.to_string());
}
if let Some(end_time_min) = &this.end_time_min {
req.url_mut().query_pairs_mut().append_pair("endTimeMin", &end_time_min.to_string());
}
if let Some(end_time_max) = &this.end_time_max {
req.url_mut().query_pairs_mut().append_pair("endTimeMax", &end_time_max.to_string());
}
if let Some(is_active) = &this.is_active {
req.url_mut().query_pairs_mut().append_pair("isActive", &is_active.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) step_name: String,
pub(crate) target_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}/steps/{}/targets/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_execution_id , & this . step_name , & this . target_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_by_job_execution {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobExecutionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobExecutionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_execution_id: String,
pub(crate) subscription_id: String,
pub(crate) create_time_min: Option<time::OffsetDateTime>,
pub(crate) create_time_max: Option<time::OffsetDateTime>,
pub(crate) end_time_min: Option<time::OffsetDateTime>,
pub(crate) end_time_max: Option<time::OffsetDateTime>,
pub(crate) is_active: Option<bool>,
pub(crate) skip: Option<i64>,
pub(crate) top: Option<i64>,
}
impl RequestBuilder {
#[doc = "If specified, only job executions created at or after the specified time are included."]
pub fn create_time_min(mut self, create_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_min = Some(create_time_min.into());
self
}
#[doc = "If specified, only job executions created before the specified time are included."]
pub fn create_time_max(mut self, create_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.create_time_max = Some(create_time_max.into());
self
}
#[doc = "If specified, only job executions completed at or after the specified time are included."]
pub fn end_time_min(mut self, end_time_min: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_min = Some(end_time_min.into());
self
}
#[doc = "If specified, only job executions completed before the specified time are included."]
pub fn end_time_max(mut self, end_time_max: impl Into<time::OffsetDateTime>) -> Self {
self.end_time_max = Some(end_time_max.into());
self
}
#[doc = "If specified, only active or only completed job executions are included."]
pub fn is_active(mut self, is_active: bool) -> Self {
self.is_active = Some(is_active);
self
}
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of elements to return from the collection."]
pub fn top(mut self, top: i64) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::JobExecutionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/executions/{}/targets" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . job_agent_name , & this . job_name , & this . job_execution_id)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(create_time_min) = &this.create_time_min {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMin", &create_time_min.to_string());
}
if let Some(create_time_max) = &this.create_time_max {
req.url_mut()
.query_pairs_mut()
.append_pair("createTimeMax", &create_time_max.to_string());
}
if let Some(end_time_min) = &this.end_time_min {
req.url_mut().query_pairs_mut().append_pair("endTimeMin", &end_time_min.to_string());
}
if let Some(end_time_max) = &this.end_time_max {
req.url_mut().query_pairs_mut().append_pair("endTimeMax", &end_time_max.to_string());
}
if let Some(is_active) = &this.is_active {
req.url_mut().query_pairs_mut().append_pair("isActive", &is_active.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod job_target_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all target groups in an agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_agent(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_agent::RequestBuilder {
list_by_agent::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a target group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `target_group_name`: The name of the target group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
target_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
target_group_name: target_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a target group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `target_group_name`: The name of the target group."]
#[doc = "* `parameters`: The requested state of the target group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
target_group_name: impl Into<String>,
parameters: impl Into<models::JobTargetGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
target_group_name: target_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a target group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `target_group_name`: The name of the target group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
target_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
target_group_name: target_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_agent {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobTargetGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobTargetGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobTargetGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/targetGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobTargetGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobTargetGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) target_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/targetGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.target_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobTargetGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobTargetGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobTargetGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) target_group_name: String,
pub(crate) parameters: models::JobTargetGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/targetGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.target_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobTargetGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) target_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/targetGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.target_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod job_versions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all versions of a job."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_job(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_job::RequestBuilder {
list_by_job::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a job version."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `job_agent_name`: The name of the job agent."]
#[doc = "* `job_name`: The name of the job."]
#[doc = "* `job_version`: The version of the job to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
job_agent_name: impl Into<String>,
job_name: impl Into<String>,
job_version: i32,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
job_agent_name: job_agent_name.into(),
job_name: job_name.into(),
job_version,
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_job {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobVersionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobVersionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobVersionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/versions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobVersion> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobVersion = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) job_agent_name: String,
pub(crate) job_name: String,
pub(crate) job_version: i32,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/jobAgents/{}/jobs/{}/versions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.job_agent_name,
&this.job_name,
&this.job_version
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobVersion>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod ledger_digest_uploads {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all ledger digest upload settings on a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the current ledger digest upload configuration for a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
ledger_digest_uploads: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
ledger_digest_uploads: ledger_digest_uploads.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
ledger_digest_uploads: impl Into<String>,
parameters: impl Into<models::LedgerDigestUploads>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
ledger_digest_uploads: ledger_digest_uploads.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn disable(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
ledger_digest_uploads: impl Into<String>,
subscription_id: impl Into<String>,
) -> disable::RequestBuilder {
disable::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
ledger_digest_uploads: ledger_digest_uploads.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LedgerDigestUploadsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LedgerDigestUploadsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::LedgerDigestUploadsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/ledgerDigestUploads",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LedgerDigestUploads> {
let bytes = self.0.into_body().collect().await?;
let body: models::LedgerDigestUploads = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) ledger_digest_uploads: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/ledgerDigestUploads/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.ledger_digest_uploads
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LedgerDigestUploads>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LedgerDigestUploads> {
let bytes = self.0.into_body().collect().await?;
let body: models::LedgerDigestUploads = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) ledger_digest_uploads: String,
pub(crate) parameters: models::LedgerDigestUploads,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/ledgerDigestUploads/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.ledger_digest_uploads
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LedgerDigestUploads>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod disable {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LedgerDigestUploads> {
let bytes = self.0.into_body().collect().await?;
let body: models::LedgerDigestUploads = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) ledger_digest_uploads: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/ledgerDigestUploads/{}/disable" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . ledger_digest_uploads)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LedgerDigestUploads>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod capabilities {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the subscription capabilities available for the specified location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location name whose capabilities are retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
include: None,
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LocationCapabilities> {
let bytes = self.0.into_body().collect().await?;
let body: models::LocationCapabilities = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
pub(crate) include: Option<String>,
}
impl RequestBuilder {
#[doc = "If specified, restricts the response to only include the selected item."]
pub fn include(mut self, include: impl Into<String>) -> Self {
self.include = Some(include.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/capabilities",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(include) = &this.include {
req.url_mut().query_pairs_mut().append_pair("include", include);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LocationCapabilities>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod long_term_retention_backups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the long term retention backups for a given location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists the long term retention backups for a given server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists all long term retention backups for a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Gets a long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Copy an existing long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `parameters`: The parameters needed for long term retention copy request"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn copy(
&self,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
parameters: impl Into<models::CopyLongTermRetentionBackupParameters>,
subscription_id: impl Into<String>,
) -> copy::RequestBuilder {
copy::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `parameters`: The requested backup resource state"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
parameters: impl Into<models::UpdateLongTermRetentionBackupParameters>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists the long term retention backups for a given location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group_location(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group_location::RequestBuilder {
list_by_resource_group_location::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists the long term retention backups for a given server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group_server(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group_server::RequestBuilder {
list_by_resource_group_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists all long term retention backups for a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group_database(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group_database::RequestBuilder {
list_by_resource_group_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Gets a long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_by_resource_group::RequestBuilder {
get_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete_by_resource_group::RequestBuilder {
delete_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Copy an existing long term retention backup to a different server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `parameters`: The parameters needed for long term retention copy request"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn copy_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
parameters: impl Into<models::CopyLongTermRetentionBackupParameters>,
subscription_id: impl Into<String>,
) -> copy_by_resource_group::RequestBuilder {
copy_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `long_term_retention_server_name`: The name of the server"]
#[doc = "* `long_term_retention_database_name`: The name of the database"]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `parameters`: The requested backup resource state"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
long_term_retention_server_name: impl Into<String>,
long_term_retention_database_name: impl Into<String>,
backup_name: impl Into<String>,
parameters: impl Into<models::UpdateLongTermRetentionBackupParameters>,
subscription_id: impl Into<String>,
) -> update_by_resource_group::RequestBuilder {
update_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
long_term_retention_server_name: long_term_retention_server_name.into(),
long_term_retention_database_name: long_term_retention_database_name.into(),
backup_name: backup_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionBackups",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionBackups",
this.client.endpoint(),
&this.subscription_id,
&this.location_name,
&this.long_term_retention_server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackup> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionBackup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod copy {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) parameters: models::CopyLongTermRetentionBackupParameters,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}/copy" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionBackupOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) parameters: models::UpdateLongTermRetentionBackupParameters,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}/update" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionBackupOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_by_resource_group_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionBackups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionBackups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . long_term_retention_server_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackup> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionBackup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod copy_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) parameters: models::CopyLongTermRetentionBackupParameters,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}/copy" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionBackupOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionBackupOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionBackupOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) long_term_retention_server_name: String,
pub(crate) long_term_retention_database_name: String,
pub(crate) backup_name: String,
pub(crate) parameters: models::UpdateLongTermRetentionBackupParameters,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionServers/{}/longTermRetentionDatabases/{}/longTermRetentionBackups/{}/update" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . long_term_retention_server_name , & this . long_term_retention_database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionBackupOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod long_term_retention_managed_instance_backups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the long term retention backups for managed databases in a given location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists all long term retention backups for a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Gets a long term retention backup for a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database."]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database."]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists the long term retention backups for a given managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists the long term retention backups for managed databases in a given location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group_location(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group_location::RequestBuilder {
list_by_resource_group_location::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Lists all long term retention backups for a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group_database(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group_database::RequestBuilder {
list_by_resource_group_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
#[doc = "Gets a long term retention backup for a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database."]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_by_resource_group::RequestBuilder {
get_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a long term retention backup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database"]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database."]
#[doc = "* `backup_name`: The backup name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
backup_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete_by_resource_group::RequestBuilder {
delete_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
backup_name: backup_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists the long term retention backups for a given managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The location of the database."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group_instance(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group_instance::RequestBuilder {
list_by_resource_group_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
only_latest_per_database: None,
database_state: None,
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstanceBackups",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionDatabases/{}/longTermRetentionManagedInstanceBackups" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionDatabases/{}/longTermRetentionManagedInstanceBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . managed_instance_name , & this . database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceLongTermRetentionBackup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionDatabases/{}/longTermRetentionManagedInstanceBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . managed_instance_name , & this . database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionManagedInstanceBackups" , this . client . endpoint () , & this . subscription_id , & this . location_name , & this . managed_instance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstanceBackups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionDatabases/{}/longTermRetentionManagedInstanceBackups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionDatabases/{}/longTermRetentionManagedInstanceBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . managed_instance_name , & this . database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceLongTermRetentionBackup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) backup_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionDatabases/{}/longTermRetentionManagedInstanceBackups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . managed_instance_name , & this . database_name , & this . backup_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_resource_group_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionBackupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionBackupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
pub(crate) only_latest_per_database: Option<bool>,
pub(crate) database_state: Option<String>,
}
impl RequestBuilder {
#[doc = "Whether or not to only get the latest backup for each database."]
pub fn only_latest_per_database(mut self, only_latest_per_database: bool) -> Self {
self.only_latest_per_database = Some(only_latest_per_database);
self
}
#[doc = "Whether to query against just live databases, just deleted databases, or all databases."]
pub fn database_state(mut self, database_state: impl Into<String>) -> Self {
self.database_state = Some(database_state.into());
self
}
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionBackupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/longTermRetentionManagedInstances/{}/longTermRetentionManagedInstanceBackups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location_name , & this . managed_instance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(only_latest_per_database) = &this.only_latest_per_database {
req.url_mut()
.query_pairs_mut()
.append_pair("onlyLatestPerDatabase", &only_latest_per_database.to_string());
}
if let Some(database_state) = &this.database_state {
req.url_mut().query_pairs_mut().append_pair("databaseState", database_state);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod long_term_retention_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a database's long term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a database's long term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be Default."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets a database's long term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be Default."]
#[doc = "* `parameters`: The long term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::LongTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::LongTermRetentionPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupLongTermRetentionPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupLongTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LongTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::LongTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::LongTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/backupLongTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LongTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod maintenance_window_options {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of available maintenance windows."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to get maintenance windows options for."]
#[doc = "* `maintenance_window_options_name`: Maintenance window options name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
maintenance_window_options_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
maintenance_window_options_name: maintenance_window_options_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MaintenanceWindowOptions> {
let bytes = self.0.into_body().collect().await?;
let body: models::MaintenanceWindowOptions = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) maintenance_window_options_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/maintenanceWindowOptions/current" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let maintenance_window_options_name = &this.maintenance_window_options_name;
req.url_mut()
.query_pairs_mut()
.append_pair("maintenanceWindowOptionsName", maintenance_window_options_name);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::MaintenanceWindowOptions>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod maintenance_windows {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets maintenance windows settings for a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to get maintenance windows for."]
#[doc = "* `maintenance_window_name`: Maintenance window name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
maintenance_window_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
maintenance_window_name: maintenance_window_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets maintenance windows settings for a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database to set maintenance windows for."]
#[doc = "* `maintenance_window_name`: Maintenance window name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
maintenance_window_name: impl Into<String>,
parameters: impl Into<models::MaintenanceWindows>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
maintenance_window_name: maintenance_window_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MaintenanceWindows> {
let bytes = self.0.into_body().collect().await?;
let body: models::MaintenanceWindows = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) maintenance_window_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/maintenanceWindows/current" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let maintenance_window_name = &this.maintenance_window_name;
req.url_mut()
.query_pairs_mut()
.append_pair("maintenanceWindowName", maintenance_window_name);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::MaintenanceWindows>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) maintenance_window_name: String,
pub(crate) parameters: models::MaintenanceWindows,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/maintenanceWindows/current" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let maintenance_window_name = &this.maintenance_window_name;
req.url_mut()
.query_pairs_mut()
.append_pair("maintenanceWindowName", maintenance_window_name);
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_backup_short_term_retention_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a managed database's short term retention policy list."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a managed database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `parameters`: The short term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::ManagedBackupShortTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a managed database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `parameters`: The short term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::ManagedBackupShortTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedBackupShortTermRetentionPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupShortTermRetentionPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedBackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::ManagedBackupShortTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedBackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::ManagedBackupShortTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedBackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_database_columns {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List managed database columns"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
schema: Vec::new(),
table: Vec::new(),
column: Vec::new(),
order_by: Vec::new(),
skiptoken: None,
}
}
#[doc = "List managed database columns"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_table(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_table::RequestBuilder {
list_by_table::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Get managed database column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseColumnListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseColumnListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) schema: Vec<String>,
pub(crate) table: Vec<String>,
pub(crate) column: Vec<String>,
pub(crate) order_by: Vec<String>,
pub(crate) skiptoken: Option<String>,
}
impl RequestBuilder {
pub fn schema(mut self, schema: Vec<String>) -> Self {
self.schema = schema;
self
}
pub fn table(mut self, table: Vec<String>) -> Self {
self.table = table;
self
}
pub fn column(mut self, column: Vec<String>) -> Self {
self.column = column;
self
}
pub fn order_by(mut self, order_by: Vec<String>) -> Self {
self.order_by = order_by;
self
}
#[doc = "An opaque token that identifies a starting point in the collection."]
pub fn skiptoken(mut self, skiptoken: impl Into<String>) -> Self {
self.skiptoken = Some(skiptoken.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseColumnListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/columns",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let schema = &this.schema;
for value in &this.schema {
req.url_mut().query_pairs_mut().append_pair("schema", &value.to_string());
}
let table = &this.table;
for value in &this.table {
req.url_mut().query_pairs_mut().append_pair("table", &value.to_string());
}
let column = &this.column;
for value in &this.column {
req.url_mut().query_pairs_mut().append_pair("column", &value.to_string());
}
let order_by = &this.order_by;
for value in &this.order_by {
req.url_mut().query_pairs_mut().append_pair("orderBy", &value.to_string());
}
if let Some(skiptoken) = &this.skiptoken {
req.url_mut().query_pairs_mut().append_pair("$skiptoken", skiptoken);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_table {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseColumnListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseColumnListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseColumnListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseColumn> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseColumn = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseColumn>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_database_queries {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get query by query id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
query_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
query_id: query_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get query execution statistics by query id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_query(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
query_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_query::RequestBuilder {
list_by_query::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
query_id: query_id.into(),
subscription_id: subscription_id.into(),
start_time: None,
end_time: None,
interval: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceQuery> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceQuery = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) query_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/queries/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name,
&this.query_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceQuery>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_by_query {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceQueryStatistics> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceQueryStatistics = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) query_id: String,
pub(crate) subscription_id: String,
pub(crate) start_time: Option<String>,
pub(crate) end_time: Option<String>,
pub(crate) interval: Option<String>,
}
impl RequestBuilder {
#[doc = "Start time for observed period."]
pub fn start_time(mut self, start_time: impl Into<String>) -> Self {
self.start_time = Some(start_time.into());
self
}
#[doc = "End time for observed period."]
pub fn end_time(mut self, end_time: impl Into<String>) -> Self {
self.end_time = Some(end_time.into());
self
}
#[doc = "The time step to be used to summarize the metric values."]
pub fn interval(mut self, interval: impl Into<String>) -> Self {
self.interval = Some(interval.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceQueryStatistics, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/queries/{}/statistics" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . query_id)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(start_time) = &this.start_time {
req.url_mut().query_pairs_mut().append_pair("startTime", start_time);
}
if let Some(end_time) = &this.end_time {
req.url_mut().query_pairs_mut().append_pair("endTime", end_time);
}
if let Some(interval) = &this.interval {
req.url_mut().query_pairs_mut().append_pair("interval", interval);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod managed_database_restore_details {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets managed database restore details."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `restore_details_name`: The name of the restore details to retrieve."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
restore_details_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
restore_details_name: restore_details_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabaseRestoreDetailsResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabaseRestoreDetailsResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) restore_details_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/restoreDetails/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . restore_details_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedDatabaseRestoreDetailsResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_databases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed databases."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new database or updates an existing database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The requested database resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::ManagedDatabase>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The requested database resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::ManagedDatabaseUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Completes the restore operation on a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The definition for completing the restore of this managed database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn complete_restore(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::CompleteDatabaseRestoreDefinition>,
subscription_id: impl Into<String>,
) -> complete_restore::RequestBuilder {
complete_restore::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of inaccessible managed databases in a managed instance"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_inaccessible_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_inaccessible_by_instance::RequestBuilder {
list_inaccessible_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedDatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabase> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabase = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedDatabase>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabase> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabase = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::ManagedDatabase,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedDatabase>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabase> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabase = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::ManagedDatabaseUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedDatabase>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod complete_restore {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::CompleteDatabaseRestoreDefinition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/completeRestore" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_inaccessible_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedDatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/inaccessibleManagedDatabases" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod managed_database_schemas {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List managed database schemas"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Get managed database schema"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSchemaListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSchemaListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseSchemaListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseSchema> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseSchema = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name,
&this.schema_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseSchema>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_database_security_alert_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed database's security alert policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the security alert policies are defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed database's security alert policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the security alert policy is defined."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a database's security alert policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the security alert policy is defined."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `parameters`: The database security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
parameters: impl Into<models::ManagedDatabaseSecurityAlertPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabaseSecurityAlertPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabaseSecurityAlertPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedDatabaseSecurityAlertPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/securityAlertPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabaseSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabaseSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/securityAlertPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . security_alert_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedDatabaseSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedDatabaseSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedDatabaseSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) parameters: models::ManagedDatabaseSecurityAlertPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/securityAlertPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . security_alert_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedDatabaseSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_database_security_events {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of security events."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the security events are retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
filter: None,
skip: None,
top: None,
skiptoken: None,
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SecurityEventCollection> {
let bytes = self.0.into_body().collect().await?;
let body: models::SecurityEventCollection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) skip: Option<i64>,
pub(crate) top: Option<i64>,
pub(crate) skiptoken: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of elements in the collection to skip."]
pub fn skip(mut self, skip: i64) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of elements to return from the collection."]
pub fn top(mut self, top: i64) -> Self {
self.top = Some(top);
self
}
#[doc = "An opaque token that identifies a starting point in the collection."]
pub fn skiptoken(mut self, skiptoken: impl Into<String>) -> Self {
self.skiptoken = Some(skiptoken.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SecurityEventCollection, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/securityEvents",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(skip) = &this.skip {
req.url_mut().query_pairs_mut().append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(skiptoken) = &this.skiptoken {
req.url_mut().query_pairs_mut().append_pair("$skiptoken", skiptoken);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod managed_database_sensitivity_labels {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the sensitivity labels of a given database"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_current_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_current_by_database::RequestBuilder {
list_current_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
skip_token: None,
count: None,
filter: None,
}
}
#[doc = "Update sensitivity labels of a given database using an operations batch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::SensitivityLabelUpdateList>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the sensitivity labels of a given database"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_recommended_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_recommended_by_database::RequestBuilder {
list_recommended_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
skip_token: None,
include_disabled_recommendations: None,
filter: None,
}
}
#[doc = "Gets the sensitivity label of a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `sensitivity_label_source`: The source of the sensitivity label."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the sensitivity label of a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `sensitivity_label_source`: The source of the sensitivity label."]
#[doc = "* `parameters`: The column sensitivity label resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
parameters: impl Into<models::SensitivityLabel>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the sensitivity label of a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `sensitivity_label_source`: The source of the sensitivity label."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Disables sensitivity recommendations on a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn disable_recommendation(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> disable_recommendation::RequestBuilder {
disable_recommendation::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns)"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn enable_recommendation(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> enable_recommendation::RequestBuilder {
enable_recommendation::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the sensitivity labels of a given database"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
}
pub mod list_current_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabelListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabelListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) skip_token: Option<String>,
pub(crate) count: Option<bool>,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
pub fn skip_token(mut self, skip_token: impl Into<String>) -> Self {
self.skip_token = Some(skip_token.into());
self
}
pub fn count(mut self, count: bool) -> Self {
self.count = Some(count);
self
}
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SensitivityLabelListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/currentSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(skip_token) = &this.skip_token {
req.url_mut().query_pairs_mut().append_pair("$skipToken", skip_token);
}
if let Some(count) = &this.count {
req.url_mut().query_pairs_mut().append_pair("$count", &count.to_string());
}
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::SensitivityLabelUpdateList,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/currentSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_recommended_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabelListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabelListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) skip_token: Option<String>,
pub(crate) include_disabled_recommendations: Option<bool>,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
pub fn skip_token(mut self, skip_token: impl Into<String>) -> Self {
self.skip_token = Some(skip_token.into());
self
}
#[doc = "Specifies whether to include disabled recommendations or not."]
pub fn include_disabled_recommendations(mut self, include_disabled_recommendations: bool) -> Self {
self.include_disabled_recommendations = Some(include_disabled_recommendations);
self
}
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SensitivityLabelListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/recommendedSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(skip_token) = &this.skip_token {
req.url_mut().query_pairs_mut().append_pair("$skipToken", skip_token);
}
if let Some(include_disabled_recommendations) = &this.include_disabled_recommendations {
req.url_mut()
.query_pairs_mut()
.append_pair("includeDisabledRecommendations", &include_disabled_recommendations.to_string());
}
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabel> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabel = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SensitivityLabel>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabel> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabel = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) parameters: models::SensitivityLabel,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SensitivityLabel>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod disable_recommendation {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/disable" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod enable_recommendation {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/enable" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabelListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabelListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SensitivityLabelListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/sensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod managed_database_recommended_sensitivity_labels {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Update recommended sensitivity labels states of a given database using an operations batch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::RecommendedSensitivityLabelUpdateList>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::RecommendedSensitivityLabelUpdateList,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/recommendedSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_database_tables {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List managed database tables"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_schema(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_schema::RequestBuilder {
list_by_schema::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Get managed database table"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_schema {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseTableListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseTableListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseTableListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseTable> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseTable = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/schemas/{}/tables/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . schema_name , & this . table_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseTable>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_database_transparent_data_encryption {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed database's transparent data encryptions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the transparent data encryption is defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed database's transparent data encryption."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the transparent data encryption is defined."]
#[doc = "* `tde_name`: The name of the transparent data encryption configuration."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
tde_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
tde_name: tde_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a database's transparent data encryption configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the managed database for which the security alert policy is defined."]
#[doc = "* `tde_name`: The name of the transparent data encryption configuration."]
#[doc = "* `parameters`: The database transparent data encryption."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
tde_name: impl Into<String>,
parameters: impl Into<models::ManagedTransparentDataEncryption>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
tde_name: tde_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedTransparentDataEncryptionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedTransparentDataEncryptionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedTransparentDataEncryptionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/transparentDataEncryption" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedTransparentDataEncryption> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedTransparentDataEncryption = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) tde_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/transparentDataEncryption/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . tde_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedTransparentDataEncryption>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedTransparentDataEncryption> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedTransparentDataEncryption = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) tde_name: String,
pub(crate) parameters: models::ManagedTransparentDataEncryption,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/transparentDataEncryption/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . tde_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedTransparentDataEncryption>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_database_vulnerability_assessment_rule_baselines {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a database's vulnerability assessment rule baseline."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment rule baseline is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `rule_id`: The vulnerability assessment rule ID."]
#[doc = "* `baseline_name`: The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule)."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
rule_id: impl Into<String>,
baseline_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
rule_id: rule_id.into(),
baseline_name: baseline_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a database's vulnerability assessment rule baseline."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment rule baseline is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `rule_id`: The vulnerability assessment rule ID."]
#[doc = "* `baseline_name`: The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule)."]
#[doc = "* `parameters`: The requested rule baseline resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
rule_id: impl Into<String>,
baseline_name: impl Into<String>,
parameters: impl Into<models::DatabaseVulnerabilityAssessmentRuleBaseline>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
rule_id: rule_id.into(),
baseline_name: baseline_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Removes the database's vulnerability assessment rule baseline."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment rule baseline is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `rule_id`: The vulnerability assessment rule ID."]
#[doc = "* `baseline_name`: The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule)."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
rule_id: impl Into<String>,
baseline_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
rule_id: rule_id.into(),
baseline_name: baseline_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentRuleBaseline = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) rule_id: String,
pub(crate) baseline_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/rules/{}/baselines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name , & this . rule_id , & this . baseline_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentRuleBaseline = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) rule_id: String,
pub(crate) baseline_name: String,
pub(crate) parameters: models::DatabaseVulnerabilityAssessmentRuleBaseline,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/rules/{}/baselines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name , & this . rule_id , & this . baseline_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessmentRuleBaseline>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) rule_id: String,
pub(crate) baseline_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/rules/{}/baselines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name , & this . rule_id , & this . baseline_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_database_vulnerability_assessments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the vulnerability assessments of a managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the database's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the database's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `parameters`: The requested resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
parameters: impl Into<models::DatabaseVulnerabilityAssessment>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Removes the database's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatabaseVulnerabilityAssessmentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) parameters: models::DatabaseVulnerabilityAssessment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_database_vulnerability_assessment_scans {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the vulnerability assessment scans of a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a vulnerability assessment scan record of a database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `scan_id`: The vulnerability assessment scan Id of the scan to retrieve."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
scan_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
scan_id: scan_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Convert an existing scan result to a human readable format. If already exists nothing happens"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the scanned database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `scan_id`: The vulnerability assessment scan Id."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn export(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
scan_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> export::RequestBuilder {
export::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
scan_id: scan_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Executes a Vulnerability Assessment database scan."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `scan_id`: The vulnerability assessment scan Id of the scan to retrieve."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn initiate_scan(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
scan_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> initiate_scan::RequestBuilder {
initiate_scan::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
scan_id: scan_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VulnerabilityAssessmentScanRecordListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::VulnerabilityAssessmentScanRecordListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::VulnerabilityAssessmentScanRecordListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/scans" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VulnerabilityAssessmentScanRecord> {
let bytes = self.0.into_body().collect().await?;
let body: models::VulnerabilityAssessmentScanRecord = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) scan_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/scans/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name , & this . scan_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VulnerabilityAssessmentScanRecord>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod export {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatabaseVulnerabilityAssessmentScansExport> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatabaseVulnerabilityAssessmentScansExport = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) scan_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/scans/{}/export" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name , & this . scan_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::DatabaseVulnerabilityAssessmentScansExport>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod initiate_scan {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) scan_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/vulnerabilityAssessments/{}/scans/{}/initiateScan" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . vulnerability_assessment_name , & this . scan_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_administrators {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed instance administrators."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed instance administrator."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
administrator_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
administrator_name: administrator_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a managed instance administrator."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `parameters`: The requested administrator parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
administrator_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceAdministrator>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
administrator_name: administrator_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a managed instance administrator."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
administrator_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
administrator_name: administrator_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceAdministratorListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceAdministratorListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceAdministratorListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/administrators",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceAdministrator> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceAdministrator = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) administrator_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/administrators/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.administrator_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceAdministrator>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceAdministrator> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceAdministrator = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) administrator_name: String,
pub(crate) parameters: models::ManagedInstanceAdministrator,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/administrators/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.administrator_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceAdministrator>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) administrator_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/administrators/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.administrator_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_azure_ad_only_authentications {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server Azure Active Directory only authentications."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a specific Azure Active Directory only authentication property."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `authentication_name`: The name of server azure active directory only authentication."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
authentication_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
authentication_name: authentication_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `authentication_name`: The name of server azure active directory only authentication."]
#[doc = "* `parameters`: The required parameters for creating or updating an Active Directory only authentication property."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
authentication_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceAzureAdOnlyAuthentication>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
authentication_name: authentication_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing server Active Directory only authentication property."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `authentication_name`: The name of server azure active directory only authentication."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
authentication_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
authentication_name: authentication_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceAzureAdOnlyAuthListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceAzureAdOnlyAuthListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceAzureAdOnlyAuthListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/azureADOnlyAuthentications",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceAzureAdOnlyAuthentication> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceAzureAdOnlyAuthentication = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) authentication_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/azureADOnlyAuthentications/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . authentication_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceAzureAdOnlyAuthentication>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceAzureAdOnlyAuthentication> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceAzureAdOnlyAuthentication = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) authentication_name: String,
pub(crate) parameters: models::ManagedInstanceAzureAdOnlyAuthentication,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/azureADOnlyAuthentications/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . authentication_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceAzureAdOnlyAuthentication>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) authentication_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/azureADOnlyAuthentications/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . authentication_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_encryption_protectors {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed instance encryption protectors"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed instance encryption protector."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `encryption_protector_name`: The name of the encryption protector to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
encryption_protector_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
encryption_protector_name: encryption_protector_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing encryption protector."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `encryption_protector_name`: The name of the encryption protector to be updated."]
#[doc = "* `parameters`: The requested encryption protector resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
encryption_protector_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceEncryptionProtector>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
encryption_protector_name: encryption_protector_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Revalidates an existing encryption protector."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `encryption_protector_name`: The name of the encryption protector to be updated."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn revalidate(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
encryption_protector_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> revalidate::RequestBuilder {
revalidate::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
encryption_protector_name: encryption_protector_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceEncryptionProtectorListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceEncryptionProtectorListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceEncryptionProtectorListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/encryptionProtector",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceEncryptionProtector> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceEncryptionProtector = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) encryption_protector_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/encryptionProtector/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.encryption_protector_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceEncryptionProtector>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceEncryptionProtector> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceEncryptionProtector = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) encryption_protector_name: String,
pub(crate) parameters: models::ManagedInstanceEncryptionProtector,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/encryptionProtector/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.encryption_protector_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceEncryptionProtector>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod revalidate {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) encryption_protector_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/encryptionProtector/{}/revalidate" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . encryption_protector_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_keys {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed instance keys."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
#[doc = "Gets a managed instance key."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `key_name`: The name of the managed instance key to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
key_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
key_name: key_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a managed instance key."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `key_name`: The name of the managed instance key to be operated on (updated or created)."]
#[doc = "* `parameters`: The requested managed instance key resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
key_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceKey>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
key_name: key_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the managed instance key with the given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `key_name`: The name of the managed instance key to be deleted."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
key_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
key_name: key_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceKeyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceKeyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceKeyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/keys",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) key_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/keys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.key_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) key_name: String,
pub(crate) parameters: models::ManagedInstanceKey,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/keys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.key_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) key_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/keys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.key_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_long_term_retention_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a database's long term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed database's long term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be Default."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets a managed database's long term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `policy_name`: The policy name. Should always be Default."]
#[doc = "* `parameters`: The long term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
database_name: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceLongTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
database_name: database_name.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceLongTermRetentionPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupLongTermRetentionPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupLongTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceLongTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceLongTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceLongTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) database_name: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::ManagedInstanceLongTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/backupLongTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . database_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceLongTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_instance_operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of operations performed on the managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_managed_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_managed_instance::RequestBuilder {
list_by_managed_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a management operation on a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
operation_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
operation_id: operation_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Cancels the asynchronous operation on the managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn cancel(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
operation_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel::RequestBuilder {
cancel::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
operation_id: operation_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_managed_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceOperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceOperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceOperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/operations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceOperation = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) operation_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/operations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.operation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceOperation>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod cancel {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) operation_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/operations/{}/cancel",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.operation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_private_endpoint_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all private endpoint connections on a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_managed_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_managed_instance::RequestBuilder {
list_by_managed_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a private endpoint connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `private_endpoint_connection_name`: The name of the private endpoint connection."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Approve or reject a private endpoint connection with a given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
parameters: impl Into<models::ManagedInstancePrivateEndpointConnection>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a private endpoint connection with a given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_managed_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstancePrivateEndpointConnectionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstancePrivateEndpointConnectionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstancePrivateEndpointConnectionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/privateEndpointConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstancePrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstancePrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . private_endpoint_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstancePrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstancePrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstancePrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) parameters: models::ManagedInstancePrivateEndpointConnection,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . private_endpoint_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstancePrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . private_endpoint_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_private_link_resources {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the private link resources for SQL server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_managed_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_managed_instance::RequestBuilder {
list_by_managed_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a private link resource for SQL server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `group_name`: The name of the private link resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
group_name: group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_managed_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstancePrivateLinkListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstancePrivateLinkListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstancePrivateLinkListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/privateLinkResources",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstancePrivateLink> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstancePrivateLink = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/privateLinkResources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstancePrivateLink>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_instances {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of all managed instances in the subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a list of all managed instances in an instance pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `instance_pool_name`: The instance pool name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance_pool(
&self,
resource_group_name: impl Into<String>,
instance_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance_pool::RequestBuilder {
list_by_instance_pool::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
instance_pool_name: instance_pool_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a list of managed instances in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `parameters`: The requested managed instance resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
parameters: impl Into<models::ManagedInstance>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `parameters`: The requested managed instance resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Failovers a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance to failover."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover::RequestBuilder {
failover::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
replica_type: None,
}
}
#[doc = "Gets the collection of outbound network dependencies for the given managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_outbound_network_dependencies_by_managed_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_outbound_network_dependencies_by_managed_instance::RequestBuilder {
list_outbound_network_dependencies_by_managed_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get top resource consuming queries of a managed instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_managed_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_managed_instance::RequestBuilder {
list_by_managed_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
number_of_queries: None,
databases: None,
start_time: None,
end_time: None,
interval: None,
aggregation_function: None,
observation_metric: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/managedInstances",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_instance_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) instance_pool_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools/{}/managedInstances",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.instance_pool_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedInstanceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstance> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstance = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstance>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstance> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstance = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) parameters: models::ManagedInstance,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstance>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstance> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstance = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) parameters: models::ManagedInstanceUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstance>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod failover {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
pub(crate) replica_type: Option<String>,
}
impl RequestBuilder {
#[doc = "The type of replica to be failed over."]
pub fn replica_type(mut self, replica_type: impl Into<String>) -> Self {
self.replica_type = Some(replica_type.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/failover",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(replica_type) = &this.replica_type {
req.url_mut().query_pairs_mut().append_pair("replicaType", replica_type);
}
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_outbound_network_dependencies_by_managed_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OutboundEnvironmentEndpointCollection> {
let bytes = self.0.into_body().collect().await?;
let body: models::OutboundEnvironmentEndpointCollection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OutboundEnvironmentEndpointCollection, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/outboundNetworkDependenciesEndpoints" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_managed_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TopQueriesListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TopQueriesListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
pub(crate) number_of_queries: Option<i32>,
pub(crate) databases: Option<String>,
pub(crate) start_time: Option<String>,
pub(crate) end_time: Option<String>,
pub(crate) interval: Option<String>,
pub(crate) aggregation_function: Option<String>,
pub(crate) observation_metric: Option<String>,
}
impl RequestBuilder {
#[doc = "How many 'top queries' to return. Default is 5."]
pub fn number_of_queries(mut self, number_of_queries: i32) -> Self {
self.number_of_queries = Some(number_of_queries);
self
}
#[doc = "Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified."]
pub fn databases(mut self, databases: impl Into<String>) -> Self {
self.databases = Some(databases.into());
self
}
#[doc = "Start time for observed period."]
pub fn start_time(mut self, start_time: impl Into<String>) -> Self {
self.start_time = Some(start_time.into());
self
}
#[doc = "End time for observed period."]
pub fn end_time(mut self, end_time: impl Into<String>) -> Self {
self.end_time = Some(end_time.into());
self
}
#[doc = "The time step to be used to summarize the metric values. Default value is PT1H"]
pub fn interval(mut self, interval: impl Into<String>) -> Self {
self.interval = Some(interval.into());
self
}
#[doc = "Aggregation function to be used, default value is 'sum'"]
pub fn aggregation_function(mut self, aggregation_function: impl Into<String>) -> Self {
self.aggregation_function = Some(aggregation_function.into());
self
}
#[doc = "Metric to be used for ranking top queries. Default is 'cpu'"]
pub fn observation_metric(mut self, observation_metric: impl Into<String>) -> Self {
self.observation_metric = Some(observation_metric.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::TopQueriesListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/topqueries",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(number_of_queries) = &this.number_of_queries {
req.url_mut()
.query_pairs_mut()
.append_pair("numberOfQueries", &number_of_queries.to_string());
}
if let Some(databases) = &this.databases {
req.url_mut().query_pairs_mut().append_pair("databases", databases);
}
if let Some(start_time) = &this.start_time {
req.url_mut().query_pairs_mut().append_pair("startTime", start_time);
}
if let Some(end_time) = &this.end_time {
req.url_mut().query_pairs_mut().append_pair("endTime", end_time);
}
if let Some(interval) = &this.interval {
req.url_mut().query_pairs_mut().append_pair("interval", interval);
}
if let Some(aggregation_function) = &this.aggregation_function {
req.url_mut()
.query_pairs_mut()
.append_pair("aggregationFunction", aggregation_function);
}
if let Some(observation_metric) = &this.observation_metric {
req.url_mut().query_pairs_mut().append_pair("observationMetric", observation_metric);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod managed_instance_tde_certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Creates a TDE certificate for a given server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `parameters`: The requested TDE certificate to be created or updated."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
parameters: impl Into<models::TdeCertificate>,
subscription_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) parameters: models::TdeCertificate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/tdeCertificates",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_instance_vulnerability_assessments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the managed instance's vulnerability assessment policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance for which the vulnerability assessments is defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the managed instance's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `parameters`: The requested resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
parameters: impl Into<models::ManagedInstanceVulnerabilityAssessment>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Removes the managed instance's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceVulnerabilityAssessmentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceVulnerabilityAssessmentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedInstanceVulnerabilityAssessmentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/vulnerabilityAssessments",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/vulnerabilityAssessments/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.vulnerability_assessment_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedInstanceVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedInstanceVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) parameters: models::ManagedInstanceVulnerabilityAssessment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/vulnerabilityAssessments/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.vulnerability_assessment_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedInstanceVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/vulnerabilityAssessments/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.vulnerability_assessment_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod managed_restorable_dropped_database_backup_short_term_retention_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a dropped database's short term retention policy list."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_restorable_dropped_database(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
restorable_dropped_database_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_restorable_dropped_database::RequestBuilder {
list_by_restorable_dropped_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
restorable_dropped_database_id: restorable_dropped_database_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a dropped database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `policy_name`: The policy name."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
restorable_dropped_database_id: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
restorable_dropped_database_id: restorable_dropped_database_id.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets a database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `parameters`: The short term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
restorable_dropped_database_id: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::ManagedBackupShortTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
restorable_dropped_database_id: restorable_dropped_database_id.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets a database's short term retention policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `policy_name`: The policy name. Should always be \"default\"."]
#[doc = "* `parameters`: The short term retention policy info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
restorable_dropped_database_id: impl Into<String>,
policy_name: impl Into<String>,
parameters: impl Into<models::ManagedBackupShortTermRetentionPolicy>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
restorable_dropped_database_id: restorable_dropped_database_id.into(),
policy_name: policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_restorable_dropped_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) restorable_dropped_database_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::ManagedBackupShortTermRetentionPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/restorableDroppedDatabases/{}/backupShortTermRetentionPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . restorable_dropped_database_id)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) restorable_dropped_database_id: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/restorableDroppedDatabases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . restorable_dropped_database_id , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedBackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) restorable_dropped_database_id: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::ManagedBackupShortTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/restorableDroppedDatabases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . restorable_dropped_database_id , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedBackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedBackupShortTermRetentionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedBackupShortTermRetentionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) restorable_dropped_database_id: String,
pub(crate) policy_name: String,
pub(crate) parameters: models::ManagedBackupShortTermRetentionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/restorableDroppedDatabases/{}/backupShortTermRetentionPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . restorable_dropped_database_id , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedBackupShortTermRetentionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_server_dns_aliases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed server DNS aliases for a managed server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_managed_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_managed_instance::RequestBuilder {
list_by_managed_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server DNS alias."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
dns_alias_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
dns_alias_name: dns_alias_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a managed server DNS alias."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
dns_alias_name: impl Into<String>,
parameters: impl Into<models::ManagedServerDnsAliasCreation>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
dns_alias_name: dns_alias_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the managed server DNS alias with the given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
dns_alias_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
dns_alias_name: dns_alias_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Acquires managed server DNS alias from another managed server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn acquire(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
dns_alias_name: impl Into<String>,
parameters: impl Into<models::ManagedServerDnsAliasAcquisition>,
subscription_id: impl Into<String>,
) -> acquire::RequestBuilder {
acquire::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
dns_alias_name: dns_alias_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_managed_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerDnsAliasListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerDnsAliasListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedServerDnsAliasListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerDnsAlias> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerDnsAlias = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) dns_alias_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedServerDnsAlias>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerDnsAlias> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerDnsAlias = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) dns_alias_name: String,
pub(crate) parameters: models::ManagedServerDnsAliasCreation,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedServerDnsAlias>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) dns_alias_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod acquire {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerDnsAlias> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerDnsAlias = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) dns_alias_name: String,
pub(crate) parameters: models::ManagedServerDnsAliasAcquisition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}/acquire",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedServerDnsAlias>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod managed_server_security_alert_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the managed server's threat detection policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get a managed server's threat detection policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a threat detection policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `parameters`: The managed server security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
parameters: impl Into<models::ManagedServerSecurityAlertPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerSecurityAlertPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerSecurityAlertPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ManagedServerSecurityAlertPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/securityAlertPolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/securityAlertPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.security_alert_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedServerSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ManagedServerSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ManagedServerSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) parameters: models::ManagedServerSecurityAlertPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/securityAlertPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.security_alert_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ManagedServerSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available SQL Rest API operations."]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!("{}/providers/Microsoft.Sql/operations", this.client.endpoint(),))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod outbound_firewall_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all outbound firewall rules on a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets an outbound firewall rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
outbound_rule_fqdn: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
outbound_rule_fqdn: outbound_rule_fqdn.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Create a outbound firewall rule with a given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
outbound_rule_fqdn: impl Into<String>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
outbound_rule_fqdn: outbound_rule_fqdn.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a outbound firewall rule with a given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
outbound_rule_fqdn: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
outbound_rule_fqdn: outbound_rule_fqdn.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OutboundFirewallRuleListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::OutboundFirewallRuleListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OutboundFirewallRuleListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/outboundFirewallRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OutboundFirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::OutboundFirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) outbound_rule_fqdn: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/outboundFirewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.outbound_rule_fqdn
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::OutboundFirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OutboundFirewallRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::OutboundFirewallRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) outbound_rule_fqdn: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/outboundFirewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.outbound_rule_fqdn
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::OutboundFirewallRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) outbound_rule_fqdn: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/outboundFirewallRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.outbound_rule_fqdn
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod private_endpoint_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all private endpoint connections on a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a private endpoint connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `private_endpoint_connection_name`: The name of the private endpoint connection."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Approve or reject a private endpoint connection with a given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
parameters: impl Into<models::PrivateEndpointConnection>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a private endpoint connection with a given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnectionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnectionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PrivateEndpointConnectionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/privateEndpointConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/privateEndpointConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.private_endpoint_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) parameters: models::PrivateEndpointConnection,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/privateEndpointConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.private_endpoint_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/privateEndpointConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.private_endpoint_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod private_link_resources {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the private link resources for SQL server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a private link resource for SQL server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `group_name`: The name of the private link resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
group_name: group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateLinkResourceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateLinkResourceListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PrivateLinkResourceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/privateLinkResources",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateLinkResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateLinkResource = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/privateLinkResources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateLinkResource>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod recoverable_managed_databases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of recoverable managed databases."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a recoverable managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
recoverable_database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
recoverable_database_name: recoverable_database_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RecoverableManagedDatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::RecoverableManagedDatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::RecoverableManagedDatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/recoverableDatabases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RecoverableManagedDatabase> {
let bytes = self.0.into_body().collect().await?;
let body: models::RecoverableManagedDatabase = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) recoverable_database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/recoverableDatabases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.recoverable_database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RecoverableManagedDatabase>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod replication_links {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of replication links on database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a replication link."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `link_id`: The name of the replication link."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
link_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
link_id: link_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the replication link."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
link_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
link_id: link_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fails over from the current primary server to this server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `link_id`: The name of the replication link."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
link_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover::RequestBuilder {
failover::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
link_id: link_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fails over from the current primary server to this server allowing data loss."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `link_id`: The name of the replication link."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn failover_allow_data_loss(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
link_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> failover_allow_data_loss::RequestBuilder {
failover_allow_data_loss::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
link_id: link_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of replication links."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ReplicationLinkListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ReplicationLinkListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ReplicationLinkListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ReplicationLink> {
let bytes = self.0.into_body().collect().await?;
let body: models::ReplicationLink = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) link_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.link_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ReplicationLink>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) link_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.link_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod failover {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ReplicationLink> {
let bytes = self.0.into_body().collect().await?;
let body: models::ReplicationLink = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) link_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/failover" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . link_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ReplicationLink>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod failover_allow_data_loss {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ReplicationLink> {
let bytes = self.0.into_body().collect().await?;
let body: models::ReplicationLink = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) link_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/forceFailoverAllowDataLoss" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . link_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ReplicationLink>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ReplicationLinkListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ReplicationLinkListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ReplicationLinkListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/replicationLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod restorable_dropped_databases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of restorable dropped databases."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a restorable dropped database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
restorable_dropped_database_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
restorable_dropped_database_id: restorable_dropped_database_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorableDroppedDatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorableDroppedDatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::RestorableDroppedDatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/restorableDroppedDatabases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorableDroppedDatabase> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorableDroppedDatabase = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) restorable_dropped_database_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/restorableDroppedDatabases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.restorable_dropped_database_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RestorableDroppedDatabase>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod restorable_dropped_managed_databases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of restorable dropped managed databases."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a restorable dropped managed database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
restorable_dropped_database_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
restorable_dropped_database_id: restorable_dropped_database_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorableDroppedManagedDatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorableDroppedManagedDatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::RestorableDroppedManagedDatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/restorableDroppedDatabases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorableDroppedManagedDatabase> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorableDroppedManagedDatabase = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) restorable_dropped_database_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/restorableDroppedDatabases/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . managed_instance_name , & this . restorable_dropped_database_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RestorableDroppedManagedDatabase>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod restore_points {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of database restore points."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a restore point for a data warehouse."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `parameters`: The definition for creating the restore point of this database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::CreateDatabaseRestorePointDefinition>,
subscription_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a restore point."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `restore_point_name`: The name of the restore point."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
restore_point_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
restore_point_name: restore_point_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a restore point."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `restore_point_name`: The name of the restore point."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
restore_point_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
restore_point_name: restore_point_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorePointListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorePointListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::RestorePointListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/restorePoints",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorePoint> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorePoint = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::CreateDatabaseRestorePointDefinition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/restorePoints",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RestorePoint>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RestorePoint> {
let bytes = self.0.into_body().collect().await?;
let body: models::RestorePoint = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) restore_point_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/restorePoints/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.restore_point_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RestorePoint>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) restore_point_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/restorePoints/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.restore_point_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod sensitivity_labels {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the sensitivity labels of a given database"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_current_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_current_by_database::RequestBuilder {
list_current_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
skip_token: None,
count: None,
filter: None,
}
}
#[doc = "Update sensitivity labels of a given database using an operations batch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::SensitivityLabelUpdateList>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the sensitivity labels of a given database"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_recommended_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_recommended_by_database::RequestBuilder {
list_recommended_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
skip_token: None,
include_disabled_recommendations: None,
filter: None,
}
}
#[doc = "Gets the sensitivity label of a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `sensitivity_label_source`: The source of the sensitivity label."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the sensitivity label of a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `sensitivity_label_source`: The source of the sensitivity label."]
#[doc = "* `parameters`: The column sensitivity label resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
parameters: impl Into<models::SensitivityLabel>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the sensitivity label of a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `sensitivity_label_source`: The source of the sensitivity label."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Disables sensitivity recommendations on a given column"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn disable_recommendation(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> disable_recommendation::RequestBuilder {
disable_recommendation::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns)"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `schema_name`: The name of the schema."]
#[doc = "* `table_name`: The name of the table."]
#[doc = "* `column_name`: The name of the column."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn enable_recommendation(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
schema_name: impl Into<String>,
table_name: impl Into<String>,
column_name: impl Into<String>,
sensitivity_label_source: impl Into<String>,
subscription_id: impl Into<String>,
) -> enable_recommendation::RequestBuilder {
enable_recommendation::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
schema_name: schema_name.into(),
table_name: table_name.into(),
column_name: column_name.into(),
sensitivity_label_source: sensitivity_label_source.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the sensitivity labels of a given database"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
filter: None,
}
}
}
pub mod list_current_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabelListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabelListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) skip_token: Option<String>,
pub(crate) count: Option<bool>,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
pub fn skip_token(mut self, skip_token: impl Into<String>) -> Self {
self.skip_token = Some(skip_token.into());
self
}
pub fn count(mut self, count: bool) -> Self {
self.count = Some(count);
self
}
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SensitivityLabelListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/currentSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(skip_token) = &this.skip_token {
req.url_mut().query_pairs_mut().append_pair("$skipToken", skip_token);
}
if let Some(count) = &this.count {
req.url_mut().query_pairs_mut().append_pair("$count", &count.to_string());
}
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::SensitivityLabelUpdateList,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/currentSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_recommended_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabelListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabelListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) skip_token: Option<String>,
pub(crate) include_disabled_recommendations: Option<bool>,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
pub fn skip_token(mut self, skip_token: impl Into<String>) -> Self {
self.skip_token = Some(skip_token.into());
self
}
#[doc = "Specifies whether to include disabled recommendations or not."]
pub fn include_disabled_recommendations(mut self, include_disabled_recommendations: bool) -> Self {
self.include_disabled_recommendations = Some(include_disabled_recommendations);
self
}
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SensitivityLabelListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/recommendedSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(skip_token) = &this.skip_token {
req.url_mut().query_pairs_mut().append_pair("$skipToken", skip_token);
}
if let Some(include_disabled_recommendations) = &this.include_disabled_recommendations {
req.url_mut()
.query_pairs_mut()
.append_pair("includeDisabledRecommendations", &include_disabled_recommendations.to_string());
}
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabel> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabel = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SensitivityLabel>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabel> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabel = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) parameters: models::SensitivityLabel,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SensitivityLabel>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod disable_recommendation {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/disable" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod enable_recommendation {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) schema_name: String,
pub(crate) table_name: String,
pub(crate) column_name: String,
pub(crate) sensitivity_label_source: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/enable" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . schema_name , & this . table_name , & this . column_name , & this . sensitivity_label_source)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SensitivityLabelListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SensitivityLabelListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "An OData filter expression that filters elements in the collection."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SensitivityLabelListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/sensitivityLabels",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod recommended_sensitivity_labels {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Update recommended sensitivity labels states of a given database using an operations batch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
parameters: impl Into<models::RecommendedSensitivityLabelUpdateList>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) parameters: models::RecommendedSensitivityLabelUpdateList,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/recommendedSensitivityLabels" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod server_advanced_threat_protection_settings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get a list of the server's Advanced Threat Protection states."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get a server's Advanced Threat Protection state."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `advanced_threat_protection_name`: The name of the Advanced Threat Protection state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
advanced_threat_protection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
advanced_threat_protection_name: advanced_threat_protection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an Advanced Threat Protection state."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `advanced_threat_protection_name`: The name of the Advanced Threat Protection state."]
#[doc = "* `parameters`: The server Advanced Threat Protection state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
advanced_threat_protection_name: impl Into<String>,
parameters: impl Into<models::ServerAdvancedThreatProtection>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
advanced_threat_protection_name: advanced_threat_protection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LogicalServerAdvancedThreatProtectionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LogicalServerAdvancedThreatProtectionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::LogicalServerAdvancedThreatProtectionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/advancedThreatProtectionSettings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAdvancedThreatProtection> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAdvancedThreatProtection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) advanced_threat_protection_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/advancedThreatProtectionSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.advanced_threat_protection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAdvancedThreatProtection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAdvancedThreatProtection> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAdvancedThreatProtection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) advanced_threat_protection_name: String,
pub(crate) parameters: models::ServerAdvancedThreatProtection,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/advancedThreatProtectionSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.advanced_threat_protection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAdvancedThreatProtection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_advisors {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server advisors."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a server advisor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `advisor_name`: The name of the Server Advisor."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
advisor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
advisor_name: advisor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a server advisor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `advisor_name`: The name of the Server Advisor."]
#[doc = "* `parameters`: The requested advisor resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
advisor_name: impl Into<String>,
parameters: impl Into<models::Advisor>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
advisor_name: advisor_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::Advisor>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::Advisor> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/advisors",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::Advisor>>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Advisor> {
let bytes = self.0.into_body().collect().await?;
let body: models::Advisor = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) advisor_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/advisors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.advisor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Advisor>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Advisor> {
let bytes = self.0.into_body().collect().await?;
let body: models::Advisor = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) advisor_name: String,
pub(crate) parameters: models::Advisor,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/advisors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.advisor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Advisor>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_automatic_tuning {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves server automatic tuning options."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update automatic tuning options on server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `parameters`: The requested automatic tuning resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
parameters: impl Into<models::ServerAutomaticTuning>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAutomaticTuning> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAutomaticTuning = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/automaticTuning/current",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAutomaticTuning>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAutomaticTuning> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAutomaticTuning = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) parameters: models::ServerAutomaticTuning,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/automaticTuning/current",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAutomaticTuning>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_azure_ad_administrators {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of Azure Active Directory administrators in a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a Azure Active Directory administrator."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `administrator_name`: The name of server active directory administrator."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
administrator_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
administrator_name: administrator_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an existing Azure Active Directory administrator."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `administrator_name`: The name of server active directory administrator."]
#[doc = "* `parameters`: The requested Azure Active Directory administrator Resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
administrator_name: impl Into<String>,
parameters: impl Into<models::ServerAzureAdAdministrator>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
administrator_name: administrator_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the Azure Active Directory administrator with the given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `administrator_name`: The name of server active directory administrator."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
administrator_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
administrator_name: administrator_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AdministratorListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::AdministratorListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::AdministratorListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/administrators",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAzureAdAdministrator> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAzureAdAdministrator = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) administrator_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/administrators/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.administrator_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAzureAdAdministrator>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAzureAdAdministrator> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAzureAdAdministrator = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) administrator_name: String,
pub(crate) parameters: models::ServerAzureAdAdministrator,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/administrators/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.administrator_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAzureAdAdministrator>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) administrator_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/administrators/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.administrator_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod server_azure_ad_only_authentications {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server Azure Active Directory only authentications."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a specific Azure Active Directory only authentication property."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `authentication_name`: The name of server azure active directory only authentication."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
authentication_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
authentication_name: authentication_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `authentication_name`: The name of server azure active directory only authentication."]
#[doc = "* `parameters`: The required parameters for creating or updating an Active Directory only authentication property."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
authentication_name: impl Into<String>,
parameters: impl Into<models::ServerAzureAdOnlyAuthentication>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
authentication_name: authentication_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing server Active Directory only authentication property."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `authentication_name`: The name of server azure active directory only authentication."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
authentication_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
authentication_name: authentication_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AzureAdOnlyAuthListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::AzureAdOnlyAuthListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::AzureAdOnlyAuthListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/azureADOnlyAuthentications",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAzureAdOnlyAuthentication> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAzureAdOnlyAuthentication = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) authentication_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/azureADOnlyAuthentications/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.authentication_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAzureAdOnlyAuthentication>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerAzureAdOnlyAuthentication> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerAzureAdOnlyAuthentication = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) authentication_name: String,
pub(crate) parameters: models::ServerAzureAdOnlyAuthentication,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/azureADOnlyAuthentications/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.authentication_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerAzureAdOnlyAuthentication>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) authentication_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/azureADOnlyAuthentications/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.authentication_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod server_connection_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists connection policy"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server connection policy"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `connection_policy_name`: The name of the connection policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
connection_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
connection_policy_name: connection_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a server connection policy"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `connection_policy_name`: The name of the connection policy."]
#[doc = "* `parameters`: The required parameters for updating a server connection policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
connection_policy_name: impl Into<String>,
parameters: impl Into<models::ServerConnectionPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
connection_policy_name: connection_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerConnectionPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerConnectionPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerConnectionPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/connectionPolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerConnectionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerConnectionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) connection_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/connectionPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.connection_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerConnectionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerConnectionPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerConnectionPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) connection_policy_name: String,
pub(crate) parameters: models::ServerConnectionPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/connectionPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.connection_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerConnectionPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_dev_ops_audit_settings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists DevOps audit settings of a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server's DevOps audit settings."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `dev_ops_auditing_settings_name`: The name of the devops audit settings. This should always be 'default'."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
dev_ops_auditing_settings_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
dev_ops_auditing_settings_name: dev_ops_auditing_settings_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a server's DevOps audit settings."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `dev_ops_auditing_settings_name`: The name of the devops audit settings. This should always be 'default'."]
#[doc = "* `parameters`: Properties of DevOps audit settings"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
dev_ops_auditing_settings_name: impl Into<String>,
parameters: impl Into<models::ServerDevOpsAuditingSettings>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
dev_ops_auditing_settings_name: dev_ops_auditing_settings_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDevOpsAuditSettingsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDevOpsAuditSettingsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerDevOpsAuditSettingsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/devOpsAuditingSettings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDevOpsAuditingSettings> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDevOpsAuditingSettings = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) dev_ops_auditing_settings_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/devOpsAuditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.dev_ops_auditing_settings_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerDevOpsAuditingSettings>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDevOpsAuditingSettings> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDevOpsAuditingSettings = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) dev_ops_auditing_settings_name: String,
pub(crate) parameters: models::ServerDevOpsAuditingSettings,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/devOpsAuditingSettings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.dev_ops_auditing_settings_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerDevOpsAuditingSettings>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_dns_aliases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server DNS aliases for a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server that the alias is pointing to."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server DNS alias."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server that the alias is pointing to."]
#[doc = "* `dns_alias_name`: The name of the server dns alias."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
dns_alias_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
dns_alias_name: dns_alias_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a server DNS alias."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server that the alias is pointing to."]
#[doc = "* `dns_alias_name`: The name of the server dns alias."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
dns_alias_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
dns_alias_name: dns_alias_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the server DNS alias with the given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server that the alias is pointing to."]
#[doc = "* `dns_alias_name`: The name of the server dns alias."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
dns_alias_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
dns_alias_name: dns_alias_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Acquires server DNS alias from another server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server that the alias is pointing to."]
#[doc = "* `dns_alias_name`: The name of the server dns alias."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn acquire(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
dns_alias_name: impl Into<String>,
parameters: impl Into<models::ServerDnsAliasAcquisition>,
subscription_id: impl Into<String>,
) -> acquire::RequestBuilder {
acquire::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
dns_alias_name: dns_alias_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDnsAliasListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDnsAliasListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerDnsAliasListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/dnsAliases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDnsAlias> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDnsAlias = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) dns_alias_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/dnsAliases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerDnsAlias>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDnsAlias> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDnsAlias = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) dns_alias_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/dnsAliases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerDnsAlias>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) dns_alias_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/dnsAliases/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod acquire {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerDnsAlias> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerDnsAlias = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) dns_alias_name: String,
pub(crate) parameters: models::ServerDnsAliasAcquisition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/dnsAliases/{}/acquire",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.dns_alias_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerDnsAlias>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_keys {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server keys."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server key."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `key_name`: The name of the server key to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
key_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
key_name: key_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a server key."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `key_name`: The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then the server key name should be formatted as: YourVaultName_YourKeyName_YourKeyVersion"]
#[doc = "* `parameters`: The requested server key resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
key_name: impl Into<String>,
parameters: impl Into<models::ServerKey>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
key_name: key_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the server key with the given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `key_name`: The name of the server key to be deleted."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
key_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
key_name: key_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerKeyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerKeyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerKeyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/keys",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) key_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/keys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.key_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) key_name: String,
pub(crate) parameters: models::ServerKey,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/keys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.key_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) key_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/keys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.key_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod server_operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of operations performed on the server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerOperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerOperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerOperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/operations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod servers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Determines whether a resource can be created with the specified name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `parameters`: The name availability request parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn check_name_availability(
&self,
parameters: impl Into<models::CheckNameAvailabilityRequest>,
subscription_id: impl Into<String>,
) -> check_name_availability::RequestBuilder {
check_name_availability::RequestBuilder {
client: self.0.clone(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of all servers in the subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a list of servers in a resource groups."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `parameters`: The requested server resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
parameters: impl Into<models::Server>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `parameters`: The requested server resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
parameters: impl Into<models::ServerUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Imports a bacpac into a new database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `parameters`: The database import request parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn import_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
parameters: impl Into<models::ImportNewDatabaseDefinition>,
subscription_id: impl Into<String>,
) -> import_database::RequestBuilder {
import_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod check_name_availability {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CheckNameAvailabilityResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::CheckNameAvailabilityResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) parameters: models::CheckNameAvailabilityRequest,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/checkNameAvailability",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CheckNameAvailabilityResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ServerListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/servers",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ServerListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Server> {
let bytes = self.0.into_body().collect().await?;
let body: models::Server = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The child resources to include in the response."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Server>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Server> {
let bytes = self.0.into_body().collect().await?;
let body: models::Server = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) parameters: models::Server,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Server>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Server> {
let bytes = self.0.into_body().collect().await?;
let body: models::Server = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) parameters: models::ServerUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Server>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod import_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ImportExportOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ImportExportOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) parameters: models::ImportNewDatabaseDefinition,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/import",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ImportExportOperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_security_alert_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the server's threat detection policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get a server's security alert policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `security_alert_policy_name`: The name of the security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a threat detection policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `security_alert_policy_name`: The name of the threat detection policy."]
#[doc = "* `parameters`: The server security alert policy."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
security_alert_policy_name: impl Into<String>,
parameters: impl Into<models::ServerSecurityAlertPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
security_alert_policy_name: security_alert_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LogicalServerSecurityAlertPolicyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LogicalServerSecurityAlertPolicyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::LogicalServerSecurityAlertPolicyListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/securityAlertPolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/securityAlertPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.security_alert_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerSecurityAlertPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerSecurityAlertPolicy = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) security_alert_policy_name: String,
pub(crate) parameters: models::ServerSecurityAlertPolicy,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/securityAlertPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.security_alert_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerSecurityAlertPolicy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod server_trust_certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of server trust certificates that were uploaded from box to the given Sql Managed Instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server trust certificate that was uploaded from box to Sql Managed Instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `certificate_name`: Name of of the certificate to get."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
certificate_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
certificate_name: certificate_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Uploads a server trust certificate from box to Sql Managed Instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `certificate_name`: Name of of the certificate to upload."]
#[doc = "* `parameters`: The server trust certificate info."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
certificate_name: impl Into<String>,
parameters: impl Into<models::ServerTrustCertificate>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
certificate_name: certificate_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a server trust certificate that was uploaded from box to Sql Managed Instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `certificate_name`: Name of of the certificate to delete."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
certificate_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
certificate_name: certificate_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustCertificatesListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustCertificatesListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerTrustCertificatesListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustCertificate> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustCertificate = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) certificate_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.certificate_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerTrustCertificate>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustCertificate> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustCertificate = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) certificate_name: String,
pub(crate) parameters: models::ServerTrustCertificate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.certificate_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerTrustCertificate>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) certificate_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name,
&this.certificate_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod server_trust_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists a server trust group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server trust group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `server_trust_group_name`: The name of the server trust group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
server_trust_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
server_trust_group_name: server_trust_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a server trust group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `server_trust_group_name`: The name of the server trust group."]
#[doc = "* `parameters`: The server trust group parameters."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
server_trust_group_name: impl Into<String>,
parameters: impl Into<models::ServerTrustGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
server_trust_group_name: server_trust_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a server trust group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `server_trust_group_name`: The name of the server trust group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
location_name: impl Into<String>,
server_trust_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location_name: location_name.into(),
server_trust_group_name: server_trust_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a server trust groups by instance name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance::RequestBuilder {
list_by_instance::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerTrustGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/serverTrustGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) server_trust_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/serverTrustGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.server_trust_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerTrustGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) server_trust_group_name: String,
pub(crate) parameters: models::ServerTrustGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/serverTrustGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.server_trust_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerTrustGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location_name: String,
pub(crate) server_trust_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/locations/{}/serverTrustGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location_name,
&this.server_trust_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_instance {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerTrustGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerTrustGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerTrustGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod server_vulnerability_assessments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the vulnerability assessment policies associated with a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the server's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `parameters`: The requested resource."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
parameters: impl Into<models::ServerVulnerabilityAssessment>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Removes the server's vulnerability assessment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server for which the vulnerability assessment is defined."]
#[doc = "* `vulnerability_assessment_name`: The name of the vulnerability assessment."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
vulnerability_assessment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
vulnerability_assessment_name: vulnerability_assessment_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerVulnerabilityAssessmentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerVulnerabilityAssessmentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ServerVulnerabilityAssessmentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/vulnerabilityAssessments",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/vulnerabilityAssessments/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.vulnerability_assessment_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ServerVulnerabilityAssessment> {
let bytes = self.0.into_body().collect().await?;
let body: models::ServerVulnerabilityAssessment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) parameters: models::ServerVulnerabilityAssessment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/vulnerabilityAssessments/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.vulnerability_assessment_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ServerVulnerabilityAssessment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) vulnerability_assessment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/vulnerabilityAssessments/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.vulnerability_assessment_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod sql_agent {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets current instance sql agent configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Puts new sql agent configuration to instance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `managed_instance_name`: The name of the managed instance."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
managed_instance_name: impl Into<String>,
parameters: impl Into<models::SqlAgentConfiguration>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
managed_instance_name: managed_instance_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SqlAgentConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::SqlAgentConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/sqlAgent/current",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SqlAgentConfiguration>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SqlAgentConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::SqlAgentConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) managed_instance_name: String,
pub(crate) parameters: models::SqlAgentConfiguration,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/sqlAgent/current",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.managed_instance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SqlAgentConfiguration>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod subscription_usages {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all subscription usage metrics in a given location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a subscription usage metric."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `usage_name`: Name of usage metric to return."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
location_name: impl Into<String>,
usage_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
usage_name: usage_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SubscriptionUsageListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SubscriptionUsageListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SubscriptionUsageListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/usages",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SubscriptionUsage> {
let bytes = self.0.into_body().collect().await?;
let body: models::SubscriptionUsage = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) usage_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/usages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.location_name,
&this.usage_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SubscriptionUsage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod sync_agents {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists sync agents in a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server on which the sync agent is hosted."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a sync agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server on which the sync agent is hosted."]
#[doc = "* `sync_agent_name`: The name of the sync agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
sync_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
sync_agent_name: sync_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a sync agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server on which the sync agent is hosted."]
#[doc = "* `sync_agent_name`: The name of the sync agent."]
#[doc = "* `parameters`: The requested sync agent resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
sync_agent_name: impl Into<String>,
parameters: impl Into<models::SyncAgent>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
sync_agent_name: sync_agent_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a sync agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server on which the sync agent is hosted."]
#[doc = "* `sync_agent_name`: The name of the sync agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
sync_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
sync_agent_name: sync_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Generates a sync agent key."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server on which the sync agent is hosted."]
#[doc = "* `sync_agent_name`: The name of the sync agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn generate_key(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
sync_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> generate_key::RequestBuilder {
generate_key::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
sync_agent_name: sync_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists databases linked to a sync agent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server on which the sync agent is hosted."]
#[doc = "* `sync_agent_name`: The name of the sync agent."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_linked_databases(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
sync_agent_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_linked_databases::RequestBuilder {
list_linked_databases::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
sync_agent_name: sync_agent_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncAgentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncAgentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncAgentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/syncAgents",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncAgent> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncAgent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) sync_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/syncAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.sync_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncAgent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncAgent> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncAgent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) sync_agent_name: String,
pub(crate) parameters: models::SyncAgent,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/syncAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.sync_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncAgent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) sync_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/syncAgents/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.sync_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod generate_key {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncAgentKeyProperties> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncAgentKeyProperties = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) sync_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/syncAgents/{}/generateKey",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.sync_agent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncAgentKeyProperties>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_linked_databases {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncAgentLinkedDatabaseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncAgentLinkedDatabaseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) sync_agent_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncAgentLinkedDatabaseListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/syncAgents/{}/linkedDatabases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.sync_agent_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod sync_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a collection of sync database ids."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location_name`: The name of the region where the resource is located."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_sync_database_ids(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_sync_database_ids::RequestBuilder {
list_sync_database_ids::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists sync groups under a hub database."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a sync group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a sync group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `parameters`: The requested sync group resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
parameters: impl Into<models::SyncGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a sync group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `parameters`: The requested sync group resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
parameters: impl Into<models::SyncGroup>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a sync group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Cancels a sync group synchronization."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn cancel_sync(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel_sync::RequestBuilder {
cancel_sync::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a collection of hub database schemas."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_hub_schemas(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_hub_schemas::RequestBuilder {
list_hub_schemas::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a collection of sync group logs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `start_time`: Get logs generated after this time."]
#[doc = "* `end_time`: Get logs generated before this time."]
#[doc = "* `type_`: The types of logs to retrieve."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_logs(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
start_time: impl Into<String>,
end_time: impl Into<String>,
type_: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_logs::RequestBuilder {
list_logs::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
start_time: start_time.into(),
end_time: end_time.into(),
type_: type_.into(),
subscription_id: subscription_id.into(),
continuation_token: None,
}
}
#[doc = "Refreshes a hub database schema."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn refresh_hub_schema(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> refresh_hub_schema::RequestBuilder {
refresh_hub_schema::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Triggers a sync group synchronization."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn trigger_sync(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> trigger_sync::RequestBuilder {
trigger_sync::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_sync_database_ids {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncDatabaseIdListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncDatabaseIdListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncDatabaseIdListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/syncDatabaseIds",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.sync_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) parameters: models::SyncGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.sync_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) parameters: models::SyncGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.sync_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.sync_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod cancel_sync {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/cancelSync" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_hub_schemas {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncFullSchemaPropertiesListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncFullSchemaPropertiesListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncFullSchemaPropertiesListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/hubSchemas" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_logs {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncGroupLogListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncGroupLogListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) start_time: String,
pub(crate) end_time: String,
pub(crate) type_: String,
pub(crate) subscription_id: String,
pub(crate) continuation_token: Option<String>,
}
impl RequestBuilder {
#[doc = "The continuation token for this operation."]
pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
self.continuation_token = Some(continuation_token.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::SyncGroupLogListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/logs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.sync_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let start_time = &this.start_time;
req.url_mut().query_pairs_mut().append_pair("startTime", start_time);
let end_time = &this.end_time;
req.url_mut().query_pairs_mut().append_pair("endTime", end_time);
let type_ = &this.type_;
req.url_mut().query_pairs_mut().append_pair("type", type_);
if let Some(continuation_token) = &this.continuation_token {
req.url_mut().query_pairs_mut().append_pair("continuationToken", continuation_token);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod refresh_hub_schema {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/refreshHubSchema" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod trigger_sync {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/triggerSync" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod sync_members {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists sync members in the given sync group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_sync_group(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_sync_group::RequestBuilder {
list_by_sync_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a sync member."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group on which the sync member is hosted."]
#[doc = "* `sync_member_name`: The name of the sync member."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
sync_member_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
sync_member_name: sync_member_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a sync member."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group on which the sync member is hosted."]
#[doc = "* `sync_member_name`: The name of the sync member."]
#[doc = "* `parameters`: The requested sync member resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
sync_member_name: impl Into<String>,
parameters: impl Into<models::SyncMember>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
sync_member_name: sync_member_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an existing sync member."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group on which the sync member is hosted."]
#[doc = "* `sync_member_name`: The name of the sync member."]
#[doc = "* `parameters`: The requested sync member resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
sync_member_name: impl Into<String>,
parameters: impl Into<models::SyncMember>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
sync_member_name: sync_member_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a sync member."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group on which the sync member is hosted."]
#[doc = "* `sync_member_name`: The name of the sync member."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
sync_member_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
sync_member_name: sync_member_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Refreshes a sync member database schema."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group on which the sync member is hosted."]
#[doc = "* `sync_member_name`: The name of the sync member."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn refresh_member_schema(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
sync_member_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> refresh_member_schema::RequestBuilder {
refresh_member_schema::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
sync_member_name: sync_member_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a sync member database schema."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database on which the sync group is hosted."]
#[doc = "* `sync_group_name`: The name of the sync group on which the sync member is hosted."]
#[doc = "* `sync_member_name`: The name of the sync member."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_member_schemas(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
sync_group_name: impl Into<String>,
sync_member_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_member_schemas::RequestBuilder {
list_member_schemas::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
sync_group_name: sync_group_name.into(),
sync_member_name: sync_member_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_sync_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncMemberListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncMemberListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncMemberListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncMember> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncMember = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) sync_member_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name , & this . sync_member_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncMember>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncMember> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncMember = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) sync_member_name: String,
pub(crate) parameters: models::SyncMember,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name , & this . sync_member_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncMember>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncMember> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncMember = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) sync_member_name: String,
pub(crate) parameters: models::SyncMember,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name , & this . sync_member_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::SyncMember>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) sync_member_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name , & this . sync_member_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod refresh_member_schema {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) sync_member_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers/{}/refreshSchema" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name , & this . sync_member_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_member_schemas {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SyncFullSchemaPropertiesListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SyncFullSchemaPropertiesListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) sync_group_name: String,
pub(crate) sync_member_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::SyncFullSchemaPropertiesListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/syncGroups/{}/syncMembers/{}/schemas" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . sync_group_name , & this . sync_member_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod tde_certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Creates a TDE certificate for a given server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `parameters`: The requested TDE certificate to be created or updated."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
parameters: impl Into<models::TdeCertificate>,
subscription_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) parameters: models::TdeCertificate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/tdeCertificates",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod time_zones {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of managed instance time zones by location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_location(
&self,
location_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_location::RequestBuilder {
list_by_location::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a managed instance time zone."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
location_name: impl Into<String>,
time_zone_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
location_name: location_name.into(),
time_zone_id: time_zone_id.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_location {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TimeZoneListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TimeZoneListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::TimeZoneListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/timeZones",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TimeZone> {
let bytes = self.0.into_body().collect().await?;
let body: models::TimeZone = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) location_name: String,
pub(crate) time_zone_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/locations/{}/timeZones/{}",
this.client.endpoint(),
&this.subscription_id,
&this.location_name,
&this.time_zone_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::TimeZone>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod transparent_data_encryptions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of the logical database's transparent data encryption."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the logical database for which the transparent data encryption is defined."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a logical database's transparent data encryption."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the logical database for which the transparent data encryption is defined."]
#[doc = "* `tde_name`: The name of the transparent data encryption configuration."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
tde_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
tde_name: tde_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a logical database's transparent data encryption configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the logical database for which the security alert policy is defined."]
#[doc = "* `tde_name`: The name of the transparent data encryption configuration."]
#[doc = "* `parameters`: The database transparent data encryption."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
tde_name: impl Into<String>,
parameters: impl Into<models::LogicalDatabaseTransparentDataEncryption>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
tde_name: tde_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LogicalDatabaseTransparentDataEncryptionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::LogicalDatabaseTransparentDataEncryptionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::LogicalDatabaseTransparentDataEncryptionListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/transparentDataEncryption" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LogicalDatabaseTransparentDataEncryption> {
let bytes = self.0.into_body().collect().await?;
let body: models::LogicalDatabaseTransparentDataEncryption = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) tde_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/transparentDataEncryption/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . tde_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::LogicalDatabaseTransparentDataEncryption>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LogicalDatabaseTransparentDataEncryption> {
let bytes = self.0.into_body().collect().await?;
let body: models::LogicalDatabaseTransparentDataEncryption = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) tde_name: String,
pub(crate) parameters: models::LogicalDatabaseTransparentDataEncryption,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/transparentDataEncryption/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . tde_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::LogicalDatabaseTransparentDataEncryption>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod usages {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all instance pool usage metrics"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `instance_pool_name`: The name of the instance pool to be retrieved."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_instance_pool(
&self,
resource_group_name: impl Into<String>,
instance_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_instance_pool::RequestBuilder {
list_by_instance_pool::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
instance_pool_name: instance_pool_name.into(),
subscription_id: subscription_id.into(),
expand_children: None,
}
}
}
pub mod list_by_instance_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::UsageListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::UsageListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) instance_pool_name: String,
pub(crate) subscription_id: String,
pub(crate) expand_children: Option<bool>,
}
impl RequestBuilder {
#[doc = "Optional request parameter to include managed instance usages within the instance pool."]
pub fn expand_children(mut self, expand_children: bool) -> Self {
self.expand_children = Some(expand_children);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::UsageListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/instancePools/{}/usages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.instance_pool_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
if let Some(expand_children) = &this.expand_children {
req.url_mut()
.query_pairs_mut()
.append_pair("expandChildren", &expand_children.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_clusters {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of all virtualClusters in the subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of virtual clusters in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a virtual cluster."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `virtual_cluster_name`: The name of the virtual cluster."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_cluster_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_cluster_name: virtual_cluster_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a virtual cluster."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `virtual_cluster_name`: The name of the virtual cluster."]
#[doc = "* `parameters`: The requested virtual cluster resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
virtual_cluster_name: impl Into<String>,
parameters: impl Into<models::VirtualClusterUpdate>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_cluster_name: virtual_cluster_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a virtual cluster."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `virtual_cluster_name`: The name of the virtual cluster."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_cluster_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_cluster_name: virtual_cluster_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `virtual_cluster_name`: The name of the virtual cluster."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn update_dns_servers(
&self,
resource_group_name: impl Into<String>,
virtual_cluster_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> update_dns_servers::RequestBuilder {
update_dns_servers::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_cluster_name: virtual_cluster_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualClusterListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualClusterListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::VirtualClusterListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Sql/virtualClusters",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualClusterListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualClusterListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::VirtualClusterListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/virtualClusters",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualCluster> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualCluster = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_cluster_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/virtualClusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_cluster_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualCluster>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualCluster> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualCluster = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_cluster_name: String,
pub(crate) parameters: models::VirtualClusterUpdate,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/virtualClusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_cluster_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualCluster>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_cluster_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/virtualClusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_cluster_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod update_dns_servers {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::UpdateManagedInstanceDnsServersOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::UpdateManagedInstanceDnsServersOperation = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_cluster_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/virtualClusters/{}/updateManagedInstanceDnsServers" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_cluster_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::UpdateManagedInstanceDnsServersOperation>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod virtual_network_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of virtual network rules in a server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_server(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_server::RequestBuilder {
list_by_server::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a virtual network rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `virtual_network_rule_name`: The name of the virtual network rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
virtual_network_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
virtual_network_rule_name: virtual_network_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an existing virtual network rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `virtual_network_rule_name`: The name of the virtual network rule."]
#[doc = "* `parameters`: The requested virtual Network Rule Resource state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
virtual_network_rule_name: impl Into<String>,
parameters: impl Into<models::VirtualNetworkRule>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
virtual_network_rule_name: virtual_network_rule_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the virtual network rule with the given name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `virtual_network_rule_name`: The name of the virtual network rule."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
virtual_network_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
virtual_network_rule_name: virtual_network_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_server {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualNetworkRuleListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualNetworkRuleListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::VirtualNetworkRuleListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/virtualNetworkRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualNetworkRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualNetworkRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) virtual_network_rule_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/virtualNetworkRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.virtual_network_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualNetworkRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualNetworkRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::VirtualNetworkRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) virtual_network_rule_name: String,
pub(crate) parameters: models::VirtualNetworkRule,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/virtualNetworkRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.virtual_network_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualNetworkRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) virtual_network_rule_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/virtualNetworkRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.virtual_network_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod workload_classifiers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the list of workload classifiers for a workload group"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group from which to receive the classifiers from."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_workload_group(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_workload_group::RequestBuilder {
list_by_workload_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a workload classifier"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group from which to receive the classifier from."]
#[doc = "* `workload_classifier_name`: The name of the workload classifier."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
workload_classifier_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
workload_classifier_name: workload_classifier_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a workload classifier."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group from which to receive the classifier from."]
#[doc = "* `workload_classifier_name`: The name of the workload classifier to create/update."]
#[doc = "* `parameters`: The properties of the workload classifier."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
workload_classifier_name: impl Into<String>,
parameters: impl Into<models::WorkloadClassifier>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
workload_classifier_name: workload_classifier_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a workload classifier."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group from which to receive the classifier from."]
#[doc = "* `workload_classifier_name`: The name of the workload classifier to delete."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
workload_classifier_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
workload_classifier_name: workload_classifier_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_workload_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadClassifierListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadClassifierListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadClassifierListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}/workloadClassifiers" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . workload_group_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadClassifier> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadClassifier = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) workload_classifier_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}/workloadClassifiers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . workload_group_name , & this . workload_classifier_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkloadClassifier>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadClassifier> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadClassifier = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) workload_classifier_name: String,
pub(crate) parameters: models::WorkloadClassifier,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}/workloadClassifiers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . workload_group_name , & this . workload_classifier_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkloadClassifier>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) workload_classifier_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}/workloadClassifiers/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . server_name , & this . database_name , & this . workload_group_name , & this . workload_classifier_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod workload_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the list of workload groups"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn list_by_database(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_database::RequestBuilder {
list_by_database::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a workload group"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a workload group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group."]
#[doc = "* `parameters`: The requested workload group state."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
parameters: impl Into<models::WorkloadGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a workload group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal."]
#[doc = "* `server_name`: The name of the server."]
#[doc = "* `database_name`: The name of the database."]
#[doc = "* `workload_group_name`: The name of the workload group to delete."]
#[doc = "* `subscription_id`: The subscription ID that identifies an Azure subscription."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
server_name: impl Into<String>,
database_name: impl Into<String>,
workload_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
server_name: server_name.into(),
database_name: database_name.into(),
workload_group_name: workload_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_database {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadGroupListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.workload_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkloadGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) parameters: models::WorkloadGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.workload_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkloadGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) server_name: String,
pub(crate) database_name: String,
pub(crate) workload_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/workloadGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.server_name,
&this.database_name,
&this.workload_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-11-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}